From ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 13 Oct 2022 10:40:01 +0200 Subject: Rename crate to `markdown` --- tests/heading_setext.rs | 98 ++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'tests/heading_setext.rs') diff --git a/tests/heading_setext.rs b/tests/heading_setext.rs index 6f0e572..ec8b056 100644 --- a/tests/heading_setext.rs +++ b/tests/heading_setext.rs @@ -1,7 +1,7 @@ -extern crate micromark; -use micromark::{ +extern crate markdown; +use markdown::{ mdast::{Heading, Node, Root, Text}, - micromark, micromark_to_mdast, micromark_with_options, + to_html, to_html_with_options, to_mdast, unist::Position, Constructs, Options, ParseOptions, }; @@ -10,272 +10,272 @@ use pretty_assertions::assert_eq; #[test] fn heading_setext() -> Result<(), String> { assert_eq!( - micromark("Foo *bar*\n========="), + to_html("Foo *bar*\n========="), "

Foo bar

", "should support a heading w/ an equals to (rank of 1)" ); assert_eq!( - micromark("Foo *bar*\n---------"), + to_html("Foo *bar*\n---------"), "

Foo bar

", "should support a heading w/ a dash (rank of 2)" ); assert_eq!( - micromark("Foo *bar\nbaz*\n===="), + to_html("Foo *bar\nbaz*\n===="), "

Foo bar\nbaz

", "should support line endings in setext headings" ); assert_eq!( - micromark(" Foo *bar\nbaz*\t\n===="), + to_html(" Foo *bar\nbaz*\t\n===="), "

Foo bar\nbaz

", "should not include initial and final whitespace around content" ); assert_eq!( - micromark("Foo\n-------------------------"), + to_html("Foo\n-------------------------"), "

Foo

", "should support long underlines" ); assert_eq!( - micromark("Foo\n="), + to_html("Foo\n="), "

Foo

", "should support short underlines" ); assert_eq!( - micromark(" Foo\n ==="), + to_html(" Foo\n ==="), "

Foo

", "should support indented content w/ 1 space" ); assert_eq!( - micromark(" Foo\n---"), + to_html(" Foo\n---"), "

Foo

", "should support indented content w/ 2 spaces" ); assert_eq!( - micromark(" Foo\n---"), + to_html(" Foo\n---"), "

Foo

", "should support indented content w/ 3 spaces" ); assert_eq!( - micromark(" Foo\n ---"), + to_html(" Foo\n ---"), "
Foo\n---\n
", "should not support too much indented content (1)" ); assert_eq!( - micromark(" Foo\n---"), + to_html(" Foo\n---"), "
Foo\n
\n
", "should not support too much indented content (2)" ); assert_eq!( - micromark("Foo\n ---- "), + to_html("Foo\n ---- "), "

Foo

", "should support initial and final whitespace around the underline" ); assert_eq!( - micromark("Foo\n ="), + to_html("Foo\n ="), "

Foo

", "should support whitespace before underline" ); assert_eq!( - micromark("Foo\n ="), + to_html("Foo\n ="), "

Foo\n=

", "should not support too much whitespace before underline (1)" ); assert_eq!( - micromark("Foo\n\t="), + to_html("Foo\n\t="), "

Foo\n=

", "should not support too much whitespace before underline (2)" ); assert_eq!( - micromark("Foo\n= ="), + to_html("Foo\n= ="), "

Foo\n= =

", "should not support whitespace in the underline (1)" ); assert_eq!( - micromark("Foo\n--- -"), + to_html("Foo\n--- -"), "

Foo

\n
", "should not support whitespace in the underline (2)" ); assert_eq!( - micromark("Foo \n-----"), + to_html("Foo \n-----"), "

Foo

", "should not support a hard break w/ spaces at the end" ); assert_eq!( - micromark("Foo\\\n-----"), + to_html("Foo\\\n-----"), "

Foo\\

", "should not support a hard break w/ backslash at the end" ); assert_eq!( - micromark("`Foo\n----\n`"), + to_html("`Foo\n----\n`"), "

`Foo

\n

`

", "should precede over inline constructs (1)" ); assert_eq!( - micromark(""), + to_html(""), "

<a title="a lot

\n

of dashes"/>

", "should precede over inline constructs (2)" ); assert_eq!( - micromark("> Foo\n---"), + to_html("> Foo\n---"), "
\n

Foo

\n
\n
", "should not allow underline to be lazy (1)" ); assert_eq!( - micromark("> foo\nbar\n==="), + to_html("> foo\nbar\n==="), "
\n

foo\nbar\n===

\n
", "should not allow underline to be lazy (2)" ); assert_eq!( - micromark("- Foo\n---"), + to_html("- Foo\n---"), "\n
", "should not allow underline to be lazy (3)" ); assert_eq!( - micromark("Foo\nBar\n---"), + to_html("Foo\nBar\n---"), "

Foo\nBar

", "should support line endings in setext headings" ); assert_eq!( - micromark("---\nFoo\n---\nBar\n---\nBaz"), + to_html("---\nFoo\n---\nBar\n---\nBaz"), "
\n

Foo

\n

Bar

\n

Baz

", "should support adjacent setext headings" ); assert_eq!( - micromark("\n===="), + to_html("\n===="), "

====

", "should not support empty setext headings" ); assert_eq!( - micromark("---\n---"), + to_html("---\n---"), "
\n
", "should prefer other constructs over setext headings (1)" ); assert_eq!( - micromark("- foo\n-----"), + to_html("- foo\n-----"), "\n
", "should prefer other constructs over setext headings (2)" ); assert_eq!( - micromark(" foo\n---"), + to_html(" foo\n---"), "
foo\n
\n
", "should prefer other constructs over setext headings (3)" ); assert_eq!( - micromark("> foo\n-----"), + to_html("> foo\n-----"), "
\n

foo

\n
\n
", "should prefer other constructs over setext headings (4)" ); assert_eq!( - micromark("\\> foo\n------"), + to_html("\\> foo\n------"), "

> foo

", "should support starting w/ character escapes" ); assert_eq!( - micromark("Foo\nbar\n---\nbaz"), + to_html("Foo\nbar\n---\nbaz"), "

Foo\nbar

\n

baz

", "paragraph and heading interplay (1)" ); assert_eq!( - micromark("Foo\n\nbar\n---\nbaz"), + to_html("Foo\n\nbar\n---\nbaz"), "

Foo

\n

bar

\n

baz

", "paragraph and heading interplay (2)" ); assert_eq!( - micromark("Foo\nbar\n\n---\n\nbaz"), + to_html("Foo\nbar\n\n---\n\nbaz"), "

Foo\nbar

\n
\n

baz

", "paragraph and heading interplay (3)" ); assert_eq!( - micromark("Foo\nbar\n* * *\nbaz"), + to_html("Foo\nbar\n* * *\nbaz"), "

Foo\nbar

\n
\n

baz

", "paragraph and heading interplay (4)" ); assert_eq!( - micromark("Foo\nbar\n\\---\nbaz"), + to_html("Foo\nbar\n\\---\nbaz"), "

Foo\nbar\n---\nbaz

", "paragraph and heading interplay (5)" ); // Extra: assert_eq!( - micromark("Foo \nbar\n-----"), + to_html("Foo \nbar\n-----"), "

Foo
\nbar

", "should support a hard break w/ spaces in between" ); assert_eq!( - micromark("Foo\\\nbar\n-----"), + to_html("Foo\\\nbar\n-----"), "

Foo
\nbar

", "should support a hard break w/ backslash in between" ); assert_eq!( - micromark("a\n-\nb"), + to_html("a\n-\nb"), "

a

\n

b

", "should prefer a setext heading over an interrupting list" ); assert_eq!( - micromark("> ===\na"), + to_html("> ===\na"), "
\n

===\na

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

a\n===

\n
", "should not support lazyness (2)" ); assert_eq!( - micromark("a\n- ==="), + to_html("a\n- ==="), "

a

\n", "should not support piercing (1)" ); assert_eq!( - micromark("a\n* ---"), + to_html("a\n* ---"), "

a

\n", "should not support piercing (2)" ); assert_eq!( - micromark_with_options( + to_html_with_options( "a\n-", &Options { parse: ParseOptions { @@ -293,7 +293,7 @@ fn heading_setext() -> Result<(), String> { ); assert_eq!( - micromark_to_mdast("alpha\nbravo\n==", &ParseOptions::default())?, + to_mdast("alpha\nbravo\n==", &ParseOptions::default())?, Node::Root(Root { children: vec![Node::Heading(Heading { depth: 1, -- cgit