From 1d92666865b35341e076efbefddf6e73b5e1542e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 7 Sep 2022 15:53:06 +0200 Subject: Add support for recoverable syntax errors --- tests/character_escape.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/character_escape.rs') diff --git a/tests/character_escape.rs b/tests/character_escape.rs index 2ecaa5f..e76e3e9 100644 --- a/tests/character_escape.rs +++ b/tests/character_escape.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn character_escape() { +fn character_escape() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -12,8 +12,7 @@ fn character_escape() { assert_eq!( micromark( - "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~" - ), + "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~"), "

!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~

", "should support escaped ascii punctuation" ); @@ -26,8 +25,7 @@ fn character_escape() { assert_eq!( micromark( - "\\*not emphasized*\n\\
not a tag\n\\[not a link](/foo)\n\\`not code`\n1\\. not a list\n\\* not a list\n\\# not a heading\n\\[foo]: /url \"not a reference\"\n\\ö not a character entity" - ), + "\\*not emphasized*\n\\
not a tag\n\\[not a link](/foo)\n\\`not code`\n1\\. not a list\n\\* not a list\n\\# not a heading\n\\[foo]: /url \"not a reference\"\n\\ö not a character entity"), "

*not emphasized*\n<br/> not a tag\n[not a link](/foo)\n`not code`\n1. not a list\n* not a list\n# not a heading\n[foo]: /url "not a reference"\n&ouml; not a character entity

", "should escape other constructs" ); @@ -57,7 +55,7 @@ fn character_escape() { ); assert_eq!( - micromark_with_options("", &danger), + micromark_with_options("", &danger)?, "", "should not escape in flow html" ); @@ -90,8 +88,10 @@ fn character_escape() { }, ..Options::default() } - ), + )?, "

\\> a

", "should support turning off character escapes" ); + + Ok(()) } -- cgit