diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 16:31:14 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 16:31:14 +0200 |
commit | 5403261e8213f68633a09fc3e9bc2e6e2cd777b2 (patch) | |
tree | bb3a6419ef42f7611c2cb24fe7024228f579331b /tests/link_resource.rs | |
parent | 03544cafaa82ba4bd7e0bc3372fc59549a8dc0cc (diff) | |
download | markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.gz markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.bz2 markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.zip |
Add support for turning off constructs
Diffstat (limited to 'tests/link_resource.rs')
-rw-r--r-- | tests/link_resource.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/link_resource.rs b/tests/link_resource.rs index 31e4b81..7f48fb1 100644 --- a/tests/link_resource.rs +++ b/tests/link_resource.rs @@ -1,14 +1,14 @@ extern crate micromark; use micromark::{micromark, micromark_with_options, Options}; -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; - #[test] fn link_resource() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("[link](/uri \"title\")"), "<p><a href=\"/uri\" title=\"title\">link</a></p>", @@ -52,7 +52,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" ); @@ -70,7 +70,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" ); @@ -100,7 +100,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" ); @@ -274,7 +274,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" ); @@ -312,7 +312,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" ); |