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/link_resource.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/link_resource.rs') 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]()", &danger), + micromark_with_options("[link]()", &danger)?, "

[link]()

", "should not support links w/ line endings in enclosed destination" ); @@ -71,7 +71,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[a](\n[a](c)", &danger), + micromark_with_options("[a](\n[a](c)", &danger)?, "

[a](<b)c\n[a](<b)c>\n[a](c)

", "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)?, "

link

", "should support links w/ escapes in destinations" ); @@ -275,7 +275,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[foo ", &danger), + micromark_with_options("[foo ", &danger)?, "

[foo

", "should prefer HTML over links" ); @@ -313,7 +313,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[a](\"c\")", &danger), + micromark_with_options("[a](\"c\")", &danger)?, "

[a]("c")

", "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()))))))))))))))))))))))))))))))))"), "

a

", "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())))))))))))))))))))))))))))))))))"), "

[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())))))))))))))))))))))))))))))))))

", "should not support 33 or more sets of parens" ); @@ -459,4 +457,6 @@ fn link_resource() { "

a

", "should support a single NUL character as a link resource" ); + + Ok(()) } -- cgit