diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-09-07 15:53:06 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-09-07 15:53:06 +0200 |
commit | 1d92666865b35341e076efbefddf6e73b5e1542e (patch) | |
tree | 11c05985ec7679f73473e7ea2c769465698e2f08 /tests/link_resource.rs | |
parent | e6018e52ee6ad9a8f8a0672b75bf515faf74af1f (diff) | |
download | markdown-rs-1d92666865b35341e076efbefddf6e73b5e1542e.tar.gz markdown-rs-1d92666865b35341e076efbefddf6e73b5e1542e.tar.bz2 markdown-rs-1d92666865b35341e076efbefddf6e73b5e1542e.zip |
Add support for recoverable syntax errors
Diffstat (limited to 'tests/link_resource.rs')
-rw-r--r-- | tests/link_resource.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/link_resource.rs b/tests/link_resource.rs index aaf4b8b..6bcbb8c 100644 --- a/tests/link_resource.rs +++ b/tests/link_resource.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Options}; use pretty_assertions::assert_eq; #[test] -fn link_resource() { +fn link_resource() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -53,7 +53,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[link](<foo\nbar>)", &danger), + micromark_with_options("[link](<foo\nbar>)", &danger)?, "<p>[link](<foo\nbar>)</p>", "should not support links w/ line endings in enclosed destination" ); @@ -71,7 +71,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[a](<b)c\n[a](<b)c>\n[a](<b>c)", &danger), + micromark_with_options("[a](<b)c\n[a](<b)c>\n[a](<b>c)", &danger)?, "<p>[a](<b)c\n[a](<b)c>\n[a](<b>c)</p>", "should not support links w/ unmatched enclosed destinations" ); @@ -101,7 +101,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[link](foo\\)\\:)", &danger), + micromark_with_options("[link](foo\\)\\:)", &danger)?, "<p><a href=\"foo):\">link</a></p>", "should support links w/ escapes in destinations" ); @@ -275,7 +275,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[foo <bar attr=\"](baz)\">", &danger), + micromark_with_options("[foo <bar attr=\"](baz)\">", &danger)?, "<p>[foo <bar attr=\"](baz)\"></p>", "should prefer HTML over links" ); @@ -313,7 +313,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[a](<b>\"c\")", &danger), + micromark_with_options("[a](<b>\"c\")", &danger)?, "<p>[a](<b>"c")</p>", "should require whitespace between enclosed destination and title" ); @@ -428,16 +428,14 @@ fn link_resource() { assert_eq!( micromark( - "[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32()))))))))))))))))))))))))))))))))" - ), + "[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32()))))))))))))))))))))))))))))))))"), "<p><a href=\"1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32())))))))))))))))))))))))))))))))\">a</a></p>", "should support 32 sets of parens" ); assert_eq!( micromark( - "[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32(33())))))))))))))))))))))))))))))))))" - ), + "[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32(33())))))))))))))))))))))))))))))))))"), "<p>[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32(33())))))))))))))))))))))))))))))))))</p>", "should not support 33 or more sets of parens" ); @@ -459,4 +457,6 @@ fn link_resource() { "<p><a href=\"%EF%BF%BD\">a</a></p>", "should support a single NUL character as a link resource" ); + + Ok(()) } |