From 4c06c8554c35887f8f5147783953b2b7e7c2327f Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 8 Jun 2022 15:52:16 +0200 Subject: . --- tests/thematic_break.rs | 181 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 tests/thematic_break.rs (limited to 'tests/thematic_break.rs') diff --git a/tests/thematic_break.rs b/tests/thematic_break.rs new file mode 100644 index 0000000..833fa6f --- /dev/null +++ b/tests/thematic_break.rs @@ -0,0 +1,181 @@ +extern crate micromark; +use micromark::micromark; + +#[test] +fn thematic_break() { + assert_eq!( + micromark("***\n---\n___"), + "
\n
\n
", + "should support thematic breaks w/ asterisks, dashes, and underscores" + ); + + assert_eq!( + micromark("+++"), + "

+++

", + "should not support thematic breaks w/ plusses" + ); + + assert_eq!( + micromark("==="), + "

===

", + "should not support thematic breaks w/ equals" + ); + + assert_eq!( + micromark("--"), + "

--

", + "should not support thematic breaks w/ two dashes" + ); + + assert_eq!( + micromark("**"), + "

**

", + "should not support thematic breaks w/ two asterisks" + ); + + assert_eq!( + micromark("__"), + "

__

", + "should not support thematic breaks w/ two underscores" + ); + + assert_eq!( + micromark(" ***"), + "
", + "should support thematic breaks w/ 1 space" + ); + + assert_eq!( + micromark(" ***"), + "
", + "should support thematic breaks w/ 2 spaces" + ); + + assert_eq!( + micromark(" ***"), + "
", + "should support thematic breaks w/ 3 spaces" + ); + + assert_eq!( + micromark(" ***"), + "
***\n
", + "should not support thematic breaks w/ 4 spaces" + ); + + // To do: paragraphs. + // assert_eq!( + // micromark("Foo\n ***"), + // "

Foo\n***

", + // "should not support thematic breaks w/ 4 spaces as paragraph continuation" + // ); + + assert_eq!( + micromark("_____________________________________"), + "
", + "should support thematic breaks w/ many markers" + ); + + assert_eq!( + micromark(" - - -"), + "
", + "should support thematic breaks w/ spaces (1)" + ); + + assert_eq!( + micromark(" ** * ** * ** * **"), + "
", + "should support thematic breaks w/ spaces (2)" + ); + + assert_eq!( + micromark("- - - -"), + "
", + "should support thematic breaks w/ spaces (3)" + ); + + assert_eq!( + micromark("- - - - "), + "
", + "should support thematic breaks w/ trailing spaces" + ); + + assert_eq!( + micromark("_ _ _ _ a"), + "

_ _ _ _ a

", + "should not support thematic breaks w/ other characters (1)" + ); + + assert_eq!( + micromark("a------"), + "

a------

", + "should not support thematic breaks w/ other characters (2)" + ); + + assert_eq!( + micromark("---a---"), + "

---a---

", + "should not support thematic breaks w/ other characters (3)" + ); + + // To do: phrasing. + // assert_eq!( + // micromark(" *-*"), + // "

-

", + // "should not support thematic breaks w/ mixed markers" + // ); + + // To do: lists. + // assert_eq!( + // micromark("- foo\n***\n- bar"), + // "\n
\n", + // "should support thematic breaks mixed w/ lists (1)" + // ); + + // assert_eq!( + // micromark("* Foo\n* * *\n* Bar"), + // "\n
\n", + // "should support thematic breaks mixed w/ lists (2)" + // ); + + // To do: paragraph. + // assert_eq!( + // micromark("Foo\n***\nbar"), + // "

Foo

\n
\n

bar

", + // "should support thematic breaks interrupting paragraphs" + // ); + + // To do: setext. + // assert_eq!( + // micromark("Foo\n---\nbar"), + // "

Foo

\n

bar

", + // "should not support thematic breaks w/ dashes interrupting paragraphs (setext heading)" + // ); + + // To do: list. + // assert_eq!( + // micromark("- Foo\n- * * *"), + // "", + // "should support thematic breaks in lists" + // ); + + // To do: blockquote. + // assert_eq!( + // micromark("> ---\na"), + // "
\n
\n
\n

a

", + // "should not support lazyness (1)" + // ); + + // assert_eq!( + // micromark("> a\n---"), + // "
\n

a

\n
\n
", + // "should not support lazyness (2)" + // ); + + // To do: extensions. + // assert_eq!( + // micromark("***", {extensions: [{disable: {null: ["thematicBreak"]}}]}), + // "

***

", + // "should support turning off thematic breaks" + // ); +} -- cgit