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/autolink.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/autolink.rs')
-rw-r--r-- | tests/autolink.rs | 45 |
1 files changed, 22 insertions, 23 deletions
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("<a+b+c:d>", &danger), + micromark_with_options("<a+b+c:d>", &danger)?, "<p><a href=\"a+b+c:d\">a+b+c:d</a></p>", "should support protocol autolinks w/ incorrect URIs (1, danger)" ); @@ -53,7 +53,7 @@ fn autolink() { ); assert_eq!( - micromark_with_options("<made-up-scheme://foo,bar>", &danger), + micromark_with_options("<made-up-scheme://foo,bar>", &danger)?, "<p><a href=\"made-up-scheme://foo,bar\">made-up-scheme://foo,bar</a></p>", "should support protocol autolinks w/ incorrect URIs (2, danger)" ); @@ -65,7 +65,7 @@ fn autolink() { ); assert_eq!( - micromark_with_options("<localhost:5001/foo>", &danger), + micromark_with_options("<localhost:5001/foo>", &danger)?, "<p><a href=\"localhost:5001/foo\">localhost:5001/foo</a></p>", "should support protocol autolinks w/ incorrect URIs (4)" ); @@ -182,12 +182,11 @@ fn autolink() { ); assert_eq!( - micromark( - "<asd@012345678901234567890123456789012345678901234567890123456789012>" - ), - "<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012\">asd@012345678901234567890123456789012345678901234567890123456789012</a></p>", - "should support 63 character in email autolinks domains" - ); + micromark( + "<asd@012345678901234567890123456789012345678901234567890123456789012>"), + "<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012\">asd@012345678901234567890123456789012345678901234567890123456789012</a></p>", + "should support 63 character in email autolinks domains" + ); assert_eq!( micromark("<asd@0123456789012345678901234567890123456789012345678901234567890123>"), @@ -196,12 +195,11 @@ fn autolink() { ); assert_eq!( - micromark( - "<asd@012345678901234567890123456789012345678901234567890123456789012.a>" - ), - "<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012.a\">asd@012345678901234567890123456789012345678901234567890123456789012.a</a></p>", - "should support a TLD after a 63 character domain in email autolinks" - ); + micromark( + "<asd@012345678901234567890123456789012345678901234567890123456789012.a>"), + "<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012.a\">asd@012345678901234567890123456789012345678901234567890123456789012.a</a></p>", + "should support a TLD after a 63 character domain in email autolinks" + ); assert_eq!( micromark("<asd@0123456789012345678901234567890123456789012345678901234567890123.a>"), @@ -210,12 +208,11 @@ fn autolink() { ); assert_eq!( - micromark( - "<asd@a.012345678901234567890123456789012345678901234567890123456789012>" - ), - "<p><a href=\"mailto:asd@a.012345678901234567890123456789012345678901234567890123456789012\">asd@a.012345678901234567890123456789012345678901234567890123456789012</a></p>", - "should support a 63 character TLD in email autolinks" - ); + micromark( + "<asd@a.012345678901234567890123456789012345678901234567890123456789012>"), + "<p><a href=\"mailto:asd@a.012345678901234567890123456789012345678901234567890123456789012\">asd@a.012345678901234567890123456789012345678901234567890123456789012</a></p>", + "should support a 63 character TLD in email autolinks" + ); assert_eq!( micromark("<asd@a.0123456789012345678901234567890123456789012345678901234567890123>"), @@ -257,8 +254,10 @@ fn autolink() { }, ..Options::default() } - ), + )?, "<p><a@b.co></p>", "should support turning off autolinks" ); + + Ok(()) } |