From fd3f517b69d637b07585aa90027561f8889d99fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= <paul@plutz.net> Date: Thu, 29 Aug 2024 14:34:02 +0200 Subject: [PATCH] additional tests --- tests-markdown.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/tests-markdown.sh b/tests-markdown.sh index a6bb361..01fbda1 100755 --- a/tests-markdown.sh +++ b/tests-markdown.sh @@ -47,6 +47,10 @@ assert '***strem***' '<p><strong><em>strem</em></strong></p>' "strong em" assert '***str**em*' '<p><em><strong>str</strong>em</em></p>' "em strong" assert '_**strem**_' '<p><em><strong>strem</strong></em></p>' "em strong" +assert '_foo_-> bar' '<p><em>foo</em>→ bar</p>' 'arrow' +assert '`_foo_-> bar`' '<p><code>_foo_-> bar</code></p>' 'arrow' +assert '<!-- comment --> <- comment' '<p><!-- comment --> ← comment</p>' 'arrow' + # Escaping assert "©" "<p>©</p>" "escape" assert "\©" "<p>&copy;</p>" "escape" @@ -273,4 +277,86 @@ Nesting paragraph </div>' \ "Nesting" +assert ' +| Col 1 | Col 2| Col 3 | +|-------|-------|------:| +| foo | *bar* | `qua` | +| 23 | 47 | 11 | +' \ +'<table><thead> +<tr><th align=""> Col 1 </th><th align=""> Col 2</th><th align="right"> Col 3 </th></tr> +</thead><tbody> +<tr><td align=""> foo </td><td align=""> <em>bar</em> </td><td align="right"> <code>qua</code> </td></tr> +<tr><td align=""> 23 </td><td align=""> 47 </td><td align="right"> 11 </td></tr> +</tbody></table>' \ +'Pipe Tables' + +# assert ' +# Col 1 | Col 2| Col 3 +# :-----:|-------|------: +# foo | *bar* | `qua` +# 23 | 47 | 11 | +# ' \ +# '<table><thead> +# <tr><th align="center"> Col 1 </th><th align=""> Col 2</th><th align="right"> Col 3 </th></tr> +# </thead><tbody> +# <tr><td align="center"> foo </td><td align=""> <em>bar</em> </td><td align="right"> <code>qua</code> </td></tr> +# <tr><td align="center"> 23 </td><td align=""> 47 </td><td align="right"> 11 </td></tr> +# </tbody></table>' \ +# 'Pipe Tables' + +assert '+---+---+---+ +|Col 1| Col 2 | Col 3| ++===+:==:+===+ +| * foo1 | *bar* |```| +| * foo2 | **qua** |code | +| - foo3 | `quux` |```| ++-------+-----+----+ +| 23 | 47 | 11 | ++-------+-----+----+ +' \ +'<table><thead> +<tr><th align=""><p>Col 1</p> +</th><th align="center"><p> Col 2 </p> +</th><th align=""><p> Col 3</p> +</th></tr> +</thead><tbody> +<tr><td align=""><ul> +<li>foo1 </li> +<li>foo2 </li> +</ul> +<ul> +<li>foo3 </li> +</ul> +</td><td align="center"><p> <em>bar</em> + <strong>qua</strong> + <code>quux</code> </p> +</td><td align=""><pre><code>code </code></pre> +</td></tr> +<tr><td align=""><p> 23 </p> +</td><td align="center"><p> 47 </p> +</td><td align=""><p> 11 </p> +</td></tr> +</tbody></table>' \ +'Grid Tables' + +assert '## foo + +# bar + +sub bar +------- + +### sub sub sub ### + +## sub2 bar {x} +' \ +'<section class="h2" id="0.1:foo"><h2>foo<a class="anchor" href="#0.1:foo"></a></h2> +</section><section class="h1" id="1:bar"><h1>bar<a class="anchor" href="#1:bar"></a></h1> +<section class="h2" id="1.1:sub%20bar"><h2>sub bar<a class="anchor" href="#1.1:sub%20bar"></a></h2> +<section class="h3" id="1.1.1:sub%20sub%20sub"><h3>sub sub sub<a class="anchor" href="#1.1.1:sub%20sub%20sub"></a></h3> +</section></section><section class="h2 x" id="1.2:sub2%20bar"><h2 class="x">sub2 bar<a class="anchor" href="#1.2:sub2%20bar"></a></h2> +</section></section>' \ +'Headline Nesting' + printf '\nAll test passed!\n' -- 2.39.5