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/autolink.rs | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'tests/autolink.rs') diff --git a/tests/autolink.rs b/tests/autolink.rs index b851583..4cf357a 100644 --- a/tests/autolink.rs +++ b/tests/autolink.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn autolink() { +fn autolink() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -41,7 +41,7 @@ fn autolink() { ); assert_eq!( - micromark_with_options("", &danger), + micromark_with_options("", &danger)?, "

a+b+c:d

", "should support protocol autolinks w/ incorrect URIs (1, danger)" ); @@ -53,7 +53,7 @@ fn autolink() { ); assert_eq!( - micromark_with_options("", &danger), + micromark_with_options("", &danger)?, "

made-up-scheme://foo,bar

", "should support protocol autolinks w/ incorrect URIs (2, danger)" ); @@ -65,7 +65,7 @@ fn autolink() { ); assert_eq!( - micromark_with_options("", &danger), + micromark_with_options("", &danger)?, "

localhost:5001/foo

", "should support protocol autolinks w/ incorrect URIs (4)" ); @@ -182,12 +182,11 @@ fn autolink() { ); assert_eq!( - micromark( - "" - ), - "

asd@012345678901234567890123456789012345678901234567890123456789012

", - "should support 63 character in email autolinks domains" - ); + micromark( + ""), + "

asd@012345678901234567890123456789012345678901234567890123456789012

", + "should support 63 character in email autolinks domains" + ); assert_eq!( micromark(""), @@ -196,12 +195,11 @@ fn autolink() { ); assert_eq!( - micromark( - "" - ), - "

asd@012345678901234567890123456789012345678901234567890123456789012.a

", - "should support a TLD after a 63 character domain in email autolinks" - ); + micromark( + ""), + "

asd@012345678901234567890123456789012345678901234567890123456789012.a

", + "should support a TLD after a 63 character domain in email autolinks" + ); assert_eq!( micromark(""), @@ -210,12 +208,11 @@ fn autolink() { ); assert_eq!( - micromark( - "" - ), - "

asd@a.012345678901234567890123456789012345678901234567890123456789012

", - "should support a 63 character TLD in email autolinks" - ); + micromark( + ""), + "

asd@a.012345678901234567890123456789012345678901234567890123456789012

", + "should support a 63 character TLD in email autolinks" + ); assert_eq!( micromark(""), @@ -257,8 +254,10 @@ fn autolink() { }, ..Options::default() } - ), + )?, "

<a@b.co>

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