diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 20:06:59 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 20:06:59 +0200 |
commit | 53529258c50b4d95a50f011fc6d9706039cbf118 (patch) | |
tree | 57f74caccc6db4f8552078dba2734901bc71019e | |
parent | 5141bef7df4bfdfa30315491a2e7c440a5be38f4 (diff) | |
download | markdown-rs-53529258c50b4d95a50f011fc6d9706039cbf118.tar.gz markdown-rs-53529258c50b4d95a50f011fc6d9706039cbf118.tar.bz2 markdown-rs-53529258c50b4d95a50f011fc6d9706039cbf118.zip |
Add test for broken jsx and containers
-rw-r--r-- | tests/mdx_jsx_flow.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/mdx_jsx_flow.rs b/tests/mdx_jsx_flow.rs index b2fdf30..85abcd3 100644 --- a/tests/mdx_jsx_flow.rs +++ b/tests/mdx_jsx_flow.rs @@ -111,6 +111,15 @@ fn mdx_jsx_flow_essence() -> Result<(), String> { "should support tags after tags" ); + // This is to make sure `document` passes errors through properly. + assert_eq!( + to_html_with_options("* <!a>\n1. b", &mdx) + .err() + .unwrap(), + "1:4: Unexpected character `!` (U+0021) before name, expected a character that can start a name, such as a letter, `$`, or `_` (note: to create a comment in MDX, use `{/* text */}`)", + "should handle crash in containers gracefully" + ); + assert_eq!( to_html_with_options("> <X\n/>", &mdx).err().unwrap(), "2:1: Unexpected lazy line in jsx in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", @@ -146,7 +155,7 @@ fn mdx_jsx_flow_essence() -> Result<(), String> { .err() .unwrap(), "2:1: Unexpected lazy line in jsx in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", - "should not support lazy flow (4)" + "should not support lazy flow (5)" ); assert_eq!( @@ -154,7 +163,7 @@ fn mdx_jsx_flow_essence() -> Result<(), String> { .err() .unwrap(), "2:1: Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", - "should not support lazy flow (5)" + "should not support lazy flow (6)" ); assert_eq!( @@ -162,13 +171,13 @@ fn mdx_jsx_flow_essence() -> Result<(), String> { .err() .unwrap(), "2:1: Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", - "should not support lazy flow (6)" + "should not support lazy flow (7)" ); assert_eq!( to_html_with_options("> a\n<X />", &mdx)?, "<blockquote>\n<p>a</p>\n</blockquote>\n", - "should not support lazy flow (7)" + "should not support lazy flow (8)" ); assert_eq!( |