diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-15 13:15:02 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-15 13:15:02 +0200 |
commit | 2f37ee269725b82913e937fbaaed909f10e4c464 (patch) | |
tree | 418ce551f160c5d5df54033c860f4d6e82d374ca /tests/misc_dangerous_html.rs | |
parent | 70afc162071250ccf1a855a5131154599b58034d (diff) | |
download | markdown-rs-2f37ee269725b82913e937fbaaed909f10e4c464.tar.gz markdown-rs-2f37ee269725b82913e937fbaaed909f10e4c464.tar.bz2 markdown-rs-2f37ee269725b82913e937fbaaed909f10e4c464.zip |
Add tests for dangerous options
Diffstat (limited to 'tests/misc_dangerous_html.rs')
-rw-r--r-- | tests/misc_dangerous_html.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/misc_dangerous_html.rs b/tests/misc_dangerous_html.rs new file mode 100644 index 0000000..7a0b49a --- /dev/null +++ b/tests/misc_dangerous_html.rs @@ -0,0 +1,28 @@ +extern crate micromark; +use micromark::{micromark, micromark_with_options, CompileOptions}; + +const DANGER: &CompileOptions = &CompileOptions { + allow_dangerous_html: true, + allow_dangerous_protocol: true, +}; + +#[test] +fn dangerous_html() { + assert_eq!( + micromark("<x>"), + "<x>", + "should be safe by default for flow" + ); + + assert_eq!( + micromark("a<b>"), + "<p>a<b></p>", + "should be safe by default for text" + ); + + assert_eq!( + micromark_with_options("<x>", DANGER), + "<x>", + "should be unsafe w/ `allowDangerousHtml`" + ); +} |