diff 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`" + ); +} |