From 4c06c8554c35887f8f5147783953b2b7e7c2327f Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 8 Jun 2022 15:52:16 +0200 Subject: . --- tests/html_flow.rs | 1058 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1058 insertions(+) create mode 100644 tests/html_flow.rs (limited to 'tests/html_flow.rs') diff --git a/tests/html_flow.rs b/tests/html_flow.rs new file mode 100644 index 0000000..51d1a2a --- /dev/null +++ b/tests/html_flow.rs @@ -0,0 +1,1058 @@ +extern crate micromark; +use micromark::{micromark, micromark_with_options, CompileOptions}; + +const DANGER: &CompileOptions = &CompileOptions { + allow_dangerous_html: true, +}; + +#[test] +fn html_flow() { + assert_eq!( + micromark(""), + "<!-- asd -->", + "should support a heading w/ rank 1" + ); + + assert_eq!( + micromark_with_options("", DANGER), + "", + "should support a heading w/ rank 1" + ); + + // To do: extensions. + // assert_eq!( + // micromark_with_options("", {extensions: [{disable: {null: ["htmlFlow"]}}]}), + // "

<x>

", + // "should support turning off html (flow)" + // ); +} + +#[test] +fn html_flow_1_raw() { + assert_eq!( + micromark_with_options( + "

+import Text.HTML.TagSoup
+
+main :: IO ()
+main = print $ parseTags tags
+
+okay", + DANGER + ), + "

+import Text.HTML.TagSoup
+
+main :: IO ()
+main = print $ parseTags tags
+
+

okay

", + "should support raw pre tags (type 1)" + ); + + assert_eq!( + micromark_with_options( + " +okay", + DANGER + ), + " +

okay

", + "should support raw script tags" + ); + + assert_eq!( + micromark_with_options( + " +okay", + DANGER + ), + " +

okay

", + "should support raw style tags" + ); + + assert_eq!( + micromark_with_options("\n\nfoo", DANGER), + "\n\nfoo", + "should support raw tags w/o ending" + ); + + // To do: phrasing. + // assert_eq!( + // micromark_with_options("\n*foo*", DANGER), + // "\n

foo

", + // "should support raw tags w/ start and end on a single line" + // ); + + assert_eq!( + micromark_with_options("1. *bar*", DANGER), + "1. *bar*", + "should support raw tags w/ more data on ending line" + ); + + assert_eq!( + micromark_with_options("</script\nmore

", + // "should not support a raw closing tag" + // ); + + assert_eq!( + micromark_with_options("", DANGER), + "", + "should support blank lines in raw" + ); + + // To do: block quote. + // assert_eq!( + // micromark_with_options(">