all repos — grayfriday @ d3c822509655d75b89de9a305a3771672395d588

blackfriday fork with a few changes

block_test.go (view raw)

  1//
  2// Blackfriday Markdown Processor
  3// Available at http://github.com/russross/blackfriday
  4//
  5// Copyright © 2011 Russ Ross <russ@russross.com>.
  6// Distributed under the Simplified BSD License.
  7// See README.md for details.
  8//
  9
 10//
 11// Unit tests for block parsing
 12//
 13
 14package blackfriday
 15
 16import (
 17	"testing"
 18)
 19
 20func runMarkdownBlock(input string, extensions int) string {
 21	htmlFlags := 0
 22	htmlFlags |= HTML_USE_XHTML
 23
 24	renderer := HtmlRenderer(htmlFlags, "", "")
 25
 26	return string(Markdown([]byte(input), renderer, extensions))
 27}
 28
 29func doTestsBlock(t *testing.T, tests []string, extensions int) {
 30	for i := 0; i+1 < len(tests); i += 2 {
 31		input := tests[i]
 32		expected := tests[i+1]
 33		actual := runMarkdownBlock(input, extensions)
 34		if actual != expected {
 35			t.Errorf("\nInput   [%#v]\nExpected[%#v]\nActual  [%#v]",
 36				input, expected, actual)
 37		}
 38	}
 39}
 40
 41func TestPrefixHeaderNoExtensions(t *testing.T) {
 42	var tests = []string{
 43		"# Header 1\n",
 44		"<h1>Header 1</h1>\n",
 45
 46		"## Header 2\n",
 47		"<h2>Header 2</h2>\n",
 48
 49		"### Header 3\n",
 50		"<h3>Header 3</h3>\n",
 51
 52		"#### Header 4\n",
 53		"<h4>Header 4</h4>\n",
 54
 55		"##### Header 5\n",
 56		"<h5>Header 5</h5>\n",
 57
 58		"###### Header 6\n",
 59		"<h6>Header 6</h6>\n",
 60
 61		"####### Header 7\n",
 62		"<h6># Header 7</h6>\n",
 63
 64		"#Header 1\n",
 65		"<h1>Header 1</h1>\n",
 66
 67		"##Header 2\n",
 68		"<h2>Header 2</h2>\n",
 69
 70		"###Header 3\n",
 71		"<h3>Header 3</h3>\n",
 72
 73		"####Header 4\n",
 74		"<h4>Header 4</h4>\n",
 75
 76		"#####Header 5\n",
 77		"<h5>Header 5</h5>\n",
 78
 79		"######Header 6\n",
 80		"<h6>Header 6</h6>\n",
 81
 82		"#######Header 7\n",
 83		"<h6>#Header 7</h6>\n",
 84
 85		"Hello\n# Header 1\nGoodbye\n",
 86		"<p>Hello</p>\n\n<h1>Header 1</h1>\n\n<p>Goodbye</p>\n",
 87
 88		"* List\n# Header\n* List\n",
 89		"<ul>\n<li><p>List</p>\n\n<h1>Header</h1></li>\n<li><p>List</p></li>\n</ul>\n",
 90
 91		"* List\n#Header\n* List\n",
 92		"<ul>\n<li><p>List</p>\n\n<h1>Header</h1></li>\n<li><p>List</p></li>\n</ul>\n",
 93
 94		"*   List\n    * Nested list\n    # Nested header\n",
 95		"<ul>\n<li><p>List</p>\n\n<ul>\n<li><p>Nested list</p>\n\n" +
 96			"<h1>Nested header</h1></li>\n</ul></li>\n</ul>\n",
 97	}
 98	doTestsBlock(t, tests, 0)
 99}
100
101func TestPrefixHeaderSpaceExtension(t *testing.T) {
102	var tests = []string{
103		"# Header 1\n",
104		"<h1>Header 1</h1>\n",
105
106		"## Header 2\n",
107		"<h2>Header 2</h2>\n",
108
109		"### Header 3\n",
110		"<h3>Header 3</h3>\n",
111
112		"#### Header 4\n",
113		"<h4>Header 4</h4>\n",
114
115		"##### Header 5\n",
116		"<h5>Header 5</h5>\n",
117
118		"###### Header 6\n",
119		"<h6>Header 6</h6>\n",
120
121		"####### Header 7\n",
122		"<p>####### Header 7</p>\n",
123
124		"#Header 1\n",
125		"<p>#Header 1</p>\n",
126
127		"##Header 2\n",
128		"<p>##Header 2</p>\n",
129
130		"###Header 3\n",
131		"<p>###Header 3</p>\n",
132
133		"####Header 4\n",
134		"<p>####Header 4</p>\n",
135
136		"#####Header 5\n",
137		"<p>#####Header 5</p>\n",
138
139		"######Header 6\n",
140		"<p>######Header 6</p>\n",
141
142		"#######Header 7\n",
143		"<p>#######Header 7</p>\n",
144
145		"Hello\n# Header 1\nGoodbye\n",
146		"<p>Hello</p>\n\n<h1>Header 1</h1>\n\n<p>Goodbye</p>\n",
147
148		"* List\n# Header\n* List\n",
149		"<ul>\n<li><p>List</p>\n\n<h1>Header</h1></li>\n<li><p>List</p></li>\n</ul>\n",
150
151		"* List\n#Header\n* List\n",
152		"<ul>\n<li>List\n#Header</li>\n<li>List</li>\n</ul>\n",
153
154		"*   List\n    * Nested list\n    # Nested header\n",
155		"<ul>\n<li><p>List</p>\n\n<ul>\n<li><p>Nested list</p>\n\n" +
156			"<h1>Nested header</h1></li>\n</ul></li>\n</ul>\n",
157	}
158	doTestsBlock(t, tests, EXTENSION_SPACE_HEADERS)
159}
160
161func TestUnderlineHeaders(t *testing.T) {
162	var tests = []string{
163		"Header 1\n========\n",
164		"<h1>Header 1</h1>\n",
165
166		"Header 2\n--------\n",
167		"<h2>Header 2</h2>\n",
168
169		"A\n=\n",
170		"<h1>A</h1>\n",
171
172		"B\n-\n",
173		"<h2>B</h2>\n",
174
175		"Paragraph\nHeader\n=\n",
176		"<p>Paragraph</p>\n\n<h1>Header</h1>\n",
177
178		"Header\n===\nParagraph\n",
179		"<h1>Header</h1>\n\n<p>Paragraph</p>\n",
180
181		"Header\n===\nAnother header\n---\n",
182		"<h1>Header</h1>\n\n<h2>Another header</h2>\n",
183
184		"   Header\n======\n",
185		"<h1>Header</h1>\n",
186
187		"    Code\n========\n",
188		"<pre><code>Code\n</code></pre>\n\n<p>========</p>\n",
189
190		"Header with *inline*\n=====\n",
191		"<h1>Header with <em>inline</em></h1>\n",
192
193		"*   List\n    * Sublist\n    Not a header\n    ------\n",
194		"<ul>\n<li>List\n\n<ul>\n<li>Sublist\nNot a header\n------</li>\n</ul></li>\n</ul>\n",
195
196		"Paragraph\n\n\n\n\nHeader\n===\n",
197		"<p>Paragraph</p>\n\n<h1>Header</h1>\n",
198
199		"Trailing space \n====        \n\n",
200		"<h1>Trailing space</h1>\n",
201
202		"Trailing spaces\n====        \n\n",
203		"<h1>Trailing spaces</h1>\n",
204
205		"Double underline\n=====\n=====\n",
206		"<h1>Double underline</h1>\n\n<p>=====</p>\n",
207	}
208	doTestsBlock(t, tests, 0)
209}
210
211func TestHorizontalRule(t *testing.T) {
212	var tests = []string{
213		"-\n",
214		"<p>-</p>\n",
215
216		"--\n",
217		"<p>--</p>\n",
218
219		"---\n",
220		"<hr />\n",
221
222		"----\n",
223		"<hr />\n",
224
225		"*\n",
226		"<p>*</p>\n",
227
228		"**\n",
229		"<p>**</p>\n",
230
231		"***\n",
232		"<hr />\n",
233
234		"****\n",
235		"<hr />\n",
236
237		"_\n",
238		"<p>_</p>\n",
239
240		"__\n",
241		"<p>__</p>\n",
242
243		"___\n",
244		"<hr />\n",
245
246		"____\n",
247		"<hr />\n",
248
249		"-*-\n",
250		"<p>-*-</p>\n",
251
252		"- - -\n",
253		"<hr />\n",
254
255		"* * *\n",
256		"<hr />\n",
257
258		"_ _ _\n",
259		"<hr />\n",
260
261		"-----*\n",
262		"<p>-----*</p>\n",
263
264		"   ------   \n",
265		"<hr />\n",
266
267		"Hello\n***\n",
268		"<p>Hello</p>\n\n<hr />\n",
269
270		"---\n***\n___\n",
271		"<hr />\n\n<hr />\n\n<hr />\n",
272	}
273	doTestsBlock(t, tests, 0)
274}
275
276func TestUnorderedList(t *testing.T) {
277	var tests = []string{
278		"* Hello\n",
279		"<ul>\n<li>Hello</li>\n</ul>\n",
280
281		"* Yin\n* Yang\n",
282		"<ul>\n<li>Yin</li>\n<li>Yang</li>\n</ul>\n",
283
284		"* Ting\n* Bong\n* Goo\n",
285		"<ul>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ul>\n",
286
287		"* Yin\n\n* Yang\n",
288		"<ul>\n<li><p>Yin</p></li>\n<li><p>Yang</p></li>\n</ul>\n",
289
290		"* Ting\n\n* Bong\n* Goo\n",
291		"<ul>\n<li><p>Ting</p></li>\n<li><p>Bong</p></li>\n<li><p>Goo</p></li>\n</ul>\n",
292
293		"+ Hello\n",
294		"<ul>\n<li>Hello</li>\n</ul>\n",
295
296		"+ Yin\n+ Yang\n",
297		"<ul>\n<li>Yin</li>\n<li>Yang</li>\n</ul>\n",
298
299		"+ Ting\n+ Bong\n+ Goo\n",
300		"<ul>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ul>\n",
301
302		"+ Yin\n\n+ Yang\n",
303		"<ul>\n<li><p>Yin</p></li>\n<li><p>Yang</p></li>\n</ul>\n",
304
305		"+ Ting\n\n+ Bong\n+ Goo\n",
306		"<ul>\n<li><p>Ting</p></li>\n<li><p>Bong</p></li>\n<li><p>Goo</p></li>\n</ul>\n",
307
308		"- Hello\n",
309		"<ul>\n<li>Hello</li>\n</ul>\n",
310
311		"- Yin\n- Yang\n",
312		"<ul>\n<li>Yin</li>\n<li>Yang</li>\n</ul>\n",
313
314		"- Ting\n- Bong\n- Goo\n",
315		"<ul>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ul>\n",
316
317		"- Yin\n\n- Yang\n",
318		"<ul>\n<li><p>Yin</p></li>\n<li><p>Yang</p></li>\n</ul>\n",
319
320		"- Ting\n\n- Bong\n- Goo\n",
321		"<ul>\n<li><p>Ting</p></li>\n<li><p>Bong</p></li>\n<li><p>Goo</p></li>\n</ul>\n",
322
323		"*Hello\n",
324		"<p>*Hello</p>\n",
325
326		"*   Hello \n",
327		"<ul>\n<li>Hello</li>\n</ul>\n",
328
329		"*   Hello \n    Next line \n",
330		"<ul>\n<li>Hello\nNext line</li>\n</ul>\n",
331
332		"Paragraph\n* No linebreak\n",
333		"<p>Paragraph\n* No linebreak</p>\n",
334
335		"Paragraph\n\n* Linebreak\n",
336		"<p>Paragraph</p>\n\n<ul>\n<li>Linebreak</li>\n</ul>\n",
337
338		"*   List\n    * Nested list\n",
339		"<ul>\n<li>List\n\n<ul>\n<li>Nested list</li>\n</ul></li>\n</ul>\n",
340
341		"*   List\n\n    * Nested list\n",
342		"<ul>\n<li><p>List</p>\n\n<ul>\n<li>Nested list</li>\n</ul></li>\n</ul>\n",
343
344		"*   List\n    Second line\n\n    + Nested\n",
345		"<ul>\n<li><p>List\nSecond line</p>\n\n<ul>\n<li>Nested</li>\n</ul></li>\n</ul>\n",
346
347		"*   List\n    + Nested\n\n    Continued\n",
348		"<ul>\n<li><p>List</p>\n\n<ul>\n<li>Nested</li>\n</ul>\n\n<p>Continued</p></li>\n</ul>\n",
349
350		"*   List\n   * shallow indent\n",
351		"<ul>\n<li>List\n\n<ul>\n<li>shallow indent</li>\n</ul></li>\n</ul>\n",
352
353		"* List\n" +
354			" * shallow indent\n" +
355			"  * part of second list\n" +
356			"   * still second\n" +
357			"    * almost there\n" +
358			"     * third level\n",
359		"<ul>\n" +
360			"<li>List\n\n" +
361			"<ul>\n" +
362			"<li>shallow indent</li>\n" +
363			"<li>part of second list</li>\n" +
364			"<li>still second</li>\n" +
365			"<li>almost there\n\n" +
366			"<ul>\n" +
367			"<li>third level</li>\n" +
368			"</ul></li>\n" +
369			"</ul></li>\n" +
370			"</ul>\n",
371
372		"* List\n        extra indent, same paragraph\n",
373		"<ul>\n<li>List\n    extra indent, same paragraph</li>\n</ul>\n",
374
375		"* List\n\n        code block\n",
376		"<ul>\n<li><p>List</p>\n\n<pre><code>code block\n</code></pre></li>\n</ul>\n",
377
378		"* List\n\n          code block with spaces\n",
379		"<ul>\n<li><p>List</p>\n\n<pre><code>  code block with spaces\n</code></pre></li>\n</ul>\n",
380	}
381	doTestsBlock(t, tests, 0)
382}
383
384func TestOrderedList(t *testing.T) {
385	var tests = []string{
386		"1. Hello\n",
387		"<ol>\n<li>Hello</li>\n</ol>\n",
388
389		"1. Yin\n2. Yang\n",
390		"<ol>\n<li>Yin</li>\n<li>Yang</li>\n</ol>\n",
391
392		"1. Ting\n2. Bong\n3. Goo\n",
393		"<ol>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ol>\n",
394
395		"1. Yin\n\n2. Yang\n",
396		"<ol>\n<li><p>Yin</p></li>\n<li><p>Yang</p></li>\n</ol>\n",
397
398		"1. Ting\n\n2. Bong\n3. Goo\n",
399		"<ol>\n<li><p>Ting</p></li>\n<li><p>Bong</p></li>\n<li><p>Goo</p></li>\n</ol>\n",
400
401		"1 Hello\n",
402		"<p>1 Hello</p>\n",
403
404		"1.Hello\n",
405		"<p>1.Hello</p>\n",
406
407		"1.  Hello \n",
408		"<ol>\n<li>Hello</li>\n</ol>\n",
409
410		"1.  Hello \n    Next line \n",
411		"<ol>\n<li>Hello\nNext line</li>\n</ol>\n",
412
413		"Paragraph\n1. No linebreak\n",
414		"<p>Paragraph\n1. No linebreak</p>\n",
415
416		"Paragraph\n\n1. Linebreak\n",
417		"<p>Paragraph</p>\n\n<ol>\n<li>Linebreak</li>\n</ol>\n",
418
419		"1.  List\n    1. Nested list\n",
420		"<ol>\n<li>List\n\n<ol>\n<li>Nested list</li>\n</ol></li>\n</ol>\n",
421
422		"1.  List\n\n    1. Nested list\n",
423		"<ol>\n<li><p>List</p>\n\n<ol>\n<li>Nested list</li>\n</ol></li>\n</ol>\n",
424
425		"1.  List\n    Second line\n\n    1. Nested\n",
426		"<ol>\n<li><p>List\nSecond line</p>\n\n<ol>\n<li>Nested</li>\n</ol></li>\n</ol>\n",
427
428		"1.  List\n    1. Nested\n\n    Continued\n",
429		"<ol>\n<li><p>List</p>\n\n<ol>\n<li>Nested</li>\n</ol>\n\n<p>Continued</p></li>\n</ol>\n",
430
431		"1.  List\n   1. shallow indent\n",
432		"<ol>\n<li>List\n\n<ol>\n<li>shallow indent</li>\n</ol></li>\n</ol>\n",
433
434		"1. List\n" +
435			" 1. shallow indent\n" +
436			"  2. part of second list\n" +
437			"   3. still second\n" +
438			"    4. almost there\n" +
439			"     1. third level\n",
440		"<ol>\n" +
441			"<li>List\n\n" +
442			"<ol>\n" +
443			"<li>shallow indent</li>\n" +
444			"<li>part of second list</li>\n" +
445			"<li>still second</li>\n" +
446			"<li>almost there\n\n" +
447			"<ol>\n" +
448			"<li>third level</li>\n" +
449			"</ol></li>\n" +
450			"</ol></li>\n" +
451			"</ol>\n",
452
453		"1. List\n        extra indent, same paragraph\n",
454		"<ol>\n<li>List\n    extra indent, same paragraph</li>\n</ol>\n",
455
456		"1. List\n\n        code block\n",
457		"<ol>\n<li><p>List</p>\n\n<pre><code>code block\n</code></pre></li>\n</ol>\n",
458
459		"1. List\n\n          code block with spaces\n",
460		"<ol>\n<li><p>List</p>\n\n<pre><code>  code block with spaces\n</code></pre></li>\n</ol>\n",
461
462		"1. List\n    * Mixted list\n",
463		"<ol>\n<li>List\n\n<ul>\n<li>Mixted list</li>\n</ul></li>\n</ol>\n",
464
465		"1. List\n * Mixed list\n",
466		"<ol>\n<li>List\n\n<ul>\n<li>Mixed list</li>\n</ul></li>\n</ol>\n",
467
468		"* Start with unordered\n 1. Ordered\n",
469		"<ul>\n<li>Start with unordered\n\n<ol>\n<li>Ordered</li>\n</ol></li>\n</ul>\n",
470
471		"* Start with unordered\n    1. Ordered\n",
472		"<ul>\n<li>Start with unordered\n\n<ol>\n<li>Ordered</li>\n</ol></li>\n</ul>\n",
473
474		"1. numbers\n1. are ignored\n",
475		"<ol>\n<li>numbers</li>\n<li>are ignored</li>\n</ol>\n",
476	}
477	doTestsBlock(t, tests, 0)
478}
479
480func TestPreformattedHtml(t *testing.T) {
481	var tests = []string{
482		"<div></div>\n",
483		"<div></div>\n",
484
485		"<div>\n</div>\n",
486		"<div>\n</div>\n",
487
488		"<div>\n</div>\nParagraph\n",
489		"<p><div>\n</div>\nParagraph</p>\n",
490
491		"<div class=\"foo\">\n</div>\n",
492		"<div class=\"foo\">\n</div>\n",
493
494		"<div>\nAnything here\n</div>\n",
495		"<div>\nAnything here\n</div>\n",
496
497		"<div>\n  Anything here\n</div>\n",
498		"<div>\n  Anything here\n</div>\n",
499
500		"<div>\nAnything here\n  </div>\n",
501		"<div>\nAnything here\n  </div>\n",
502
503		"<div>\nThis is *not* &proceessed\n</div>\n",
504		"<div>\nThis is *not* &proceessed\n</div>\n",
505
506		"<faketag>\n  Something\n</faketag>\n",
507		"<p><faketag>\n  Something\n</faketag></p>\n",
508
509		"<div>\n  Something here\n</divv>\n",
510		"<p><div>\n  Something here\n</divv></p>\n",
511
512		"Paragraph\n<div>\nHere? >&<\n</div>\n",
513		"<p>Paragraph\n<div>\nHere? &gt;&amp;&lt;\n</div></p>\n",
514
515		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\n",
516		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n",
517
518		"Paragraph\n<div>\nHere? >&<\n</div>\nAnd here?\n",
519		"<p>Paragraph\n<div>\nHere? &gt;&amp;&lt;\n</div>\nAnd here?</p>\n",
520
521		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\nAnd here?\n",
522		"<p>Paragraph</p>\n\n<p><div>\nHow about here? &gt;&amp;&lt;\n</div>\nAnd here?</p>\n",
523
524		"Paragraph\n<div>\nHere? >&<\n</div>\n\nAnd here?\n",
525		"<p>Paragraph\n<div>\nHere? &gt;&amp;&lt;\n</div></p>\n\n<p>And here?</p>\n",
526
527		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\n\nAnd here?\n",
528		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n\n<p>And here?</p>\n",
529	}
530	doTestsBlock(t, tests, 0)
531}
532
533func TestPreformattedHtmlLax(t *testing.T) {
534	var tests = []string{
535		"Paragraph\n<div>\nHere? >&<\n</div>\n",
536		"<p>Paragraph</p>\n\n<div>\nHere? >&<\n</div>\n",
537
538		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\n",
539		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n",
540
541		"Paragraph\n<div>\nHere? >&<\n</div>\nAnd here?\n",
542		"<p>Paragraph</p>\n\n<div>\nHere? >&<\n</div>\n\n<p>And here?</p>\n",
543
544		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\nAnd here?\n",
545		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n\n<p>And here?</p>\n",
546
547		"Paragraph\n<div>\nHere? >&<\n</div>\n\nAnd here?\n",
548		"<p>Paragraph</p>\n\n<div>\nHere? >&<\n</div>\n\n<p>And here?</p>\n",
549
550		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\n\nAnd here?\n",
551		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n\n<p>And here?</p>\n",
552	}
553	doTestsBlock(t, tests, EXTENSION_LAX_HTML_BLOCKS)
554}
555
556func TestFencedCodeBlock(t *testing.T) {
557	var tests = []string{
558		"``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n",
559		"<pre><code class=\"go\">func foo() bool {\n    return true;\n}\n</code></pre>\n",
560
561		"``` c\n/* special & char < > \" escaping */\n```\n",
562		"<pre><code class=\"c\">/* special &amp; char &lt; &gt; &quot; escaping */\n</code></pre>\n",
563
564		"``` c\nno *inline* processing ~~of text~~\n```\n",
565		"<pre><code class=\"c\">no *inline* processing ~~of text~~\n</code></pre>\n",
566
567		"```\nNo language\n```\n",
568		"<pre><code>No language\n</code></pre>\n",
569
570		"``` {ocaml}\nlanguage in braces\n```\n",
571		"<pre><code class=\"ocaml\">language in braces\n</code></pre>\n",
572
573		"```    {ocaml}      \nwith extra whitespace\n```\n",
574		"<pre><code class=\"ocaml\">with extra whitespace\n</code></pre>\n",
575
576		"```{   ocaml   }\nwith extra whitespace\n```\n",
577		"<pre><code class=\"ocaml\">with extra whitespace\n</code></pre>\n",
578
579		"~ ~~ java\nWith whitespace\n~~~\n",
580		"<p>~ ~~ java\nWith whitespace\n~~~</p>\n",
581
582		"~~\nonly two\n~~\n",
583		"<p>~~\nonly two\n~~</p>\n",
584
585		"```` python\nextra\n````\n",
586		"<pre><code class=\"python\">extra\n</code></pre>\n",
587
588		"~~~ perl\nthree to start, four to end\n~~~~\n",
589		"<p>~~~ perl\nthree to start, four to end\n~~~~</p>\n",
590
591		"~~~~ perl\nfour to start, three to end\n~~~\n",
592		"<p>~~~~ perl\nfour to start, three to end\n~~~</p>\n",
593
594		"~~~ bash\ntildes\n~~~\n",
595		"<pre><code class=\"bash\">tildes\n</code></pre>\n",
596
597		"``` lisp\nno ending\n",
598		"<p>``` lisp\nno ending</p>\n",
599
600		"~~~ lisp\nend with language\n~~~ lisp\n",
601		"<p>~~~ lisp\nend with language\n~~~ lisp</p>\n",
602
603		"```\nmismatched begin and end\n~~~\n",
604		"<p>```\nmismatched begin and end\n~~~</p>\n",
605
606		"~~~\nmismatched begin and end\n```\n",
607		"<p>~~~\nmismatched begin and end\n```</p>\n",
608
609		"   ``` oz\nleading spaces\n```\n",
610		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
611
612		"  ``` oz\nleading spaces\n ```\n",
613		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
614
615		" ``` oz\nleading spaces\n  ```\n",
616		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
617
618		"``` oz\nleading spaces\n   ```\n",
619		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
620
621		"    ``` oz\nleading spaces\n    ```\n",
622		"<pre><code>``` oz\n</code></pre>\n\n<p>leading spaces\n    ```</p>\n",
623	}
624	doTestsBlock(t, tests, EXTENSION_FENCED_CODE)
625}