diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/definition.rs | 36 | ||||
-rw-r--r-- | tests/fuzz.rs | 2 | ||||
-rw-r--r-- | tests/gfm_table.rs | 6 |
3 files changed, 43 insertions, 1 deletions
diff --git a/tests/definition.rs b/tests/definition.rs index 11f783d..6f680ff 100644 --- a/tests/definition.rs +++ b/tests/definition.rs @@ -441,6 +441,42 @@ fn definition() -> Result<(), String> { ); assert_eq!( + micromark("[\na\n=\n]: b"), + "<h1>[\na</h1>\n<p>]: b</p>", + "should prefer setext headings over definition labels" + ); + + assert_eq!( + micromark("[a]: b '\nc\n=\n'"), + "<h1>[a]: b '\nc</h1>\n<p>'</p>", + "should prefer setext headings over definition titles" + ); + + assert_eq!( + micromark("[\n***\n]: b"), + "<p>[</p>\n<hr />\n<p>]: b</p>", + "should prefer thematic breaks over definition labels" + ); + + assert_eq!( + micromark("[a]: b '\n***\n'"), + "<p>[a]: b '</p>\n<hr />\n<p>'</p>", + "should prefer thematic breaks over definition titles" + ); + + assert_eq!( + micromark("[\n```\n]: b"), + "<p>[</p>\n<pre><code>]: b\n</code></pre>\n", + "should prefer code (fenced) over definition labels" + ); + + assert_eq!( + micromark("[a]: b '\n```\n'"), + "<p>[a]: b '</p>\n<pre><code>'\n</code></pre>\n", + "should prefer code (fenced) over definition titles" + ); + + assert_eq!( micromark_with_options( "[foo]: /url \"title\"", &Options { diff --git a/tests/fuzz.rs b/tests/fuzz.rs index 146ff24..47dbea5 100644 --- a/tests/fuzz.rs +++ b/tests/fuzz.rs @@ -6,7 +6,7 @@ use pretty_assertions::assert_eq; fn fuzz() -> Result<(), String> { assert_eq!( micromark("[\n~\na\n-\n\n"), - "<p>[\n~\na</p>\n<ul>\n<li></li>\n</ul>\n", + "<h2>[\n~\na</h2>\n", "1: label, blank lines, and code" ); diff --git a/tests/gfm_table.rs b/tests/gfm_table.rs index 619bf2a..b7f884a 100644 --- a/tests/gfm_table.rs +++ b/tests/gfm_table.rs @@ -338,6 +338,12 @@ fn gfm_table() -> Result<(), String> { ); assert_eq!( + micromark_with_options("[\na\n:-\n]: b", &gfm)?, + "<p>[</p>\n<table>\n<thead>\n<tr>\n<th align=\"left\">a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align=\"left\">]: b</td>\n</tr>\n</tbody>\n</table>", + "should prefer GFM tables over definitions" + ); + + assert_eq!( micromark_with_options( r###"# Align |