diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 10:40:01 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 10:40:01 +0200 |
commit | ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a (patch) | |
tree | 2da4be3be22c2324c48cb17133b3f4b26b9139d2 /tests/heading_atx.rs | |
parent | 861af95c119721e814460fa7dc32bd3d74b38484 (diff) | |
download | markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.gz markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.bz2 markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.zip |
Rename crate to `markdown`
Diffstat (limited to 'tests/heading_atx.rs')
-rw-r--r-- | tests/heading_atx.rs | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/tests/heading_atx.rs b/tests/heading_atx.rs index 736c50a..089c2c7 100644 --- a/tests/heading_atx.rs +++ b/tests/heading_atx.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,205 +10,205 @@ use pretty_assertions::assert_eq; #[test] fn heading_atx() -> Result<(), String> { assert_eq!( - micromark("# foo"), + to_html("# foo"), "<h1>foo</h1>", "should support a heading w/ rank 1" ); assert_eq!( - micromark("## foo"), + to_html("## foo"), "<h2>foo</h2>", "should support a heading w/ rank 2" ); assert_eq!( - micromark("### foo"), + to_html("### foo"), "<h3>foo</h3>", "should support a heading w/ rank 3" ); assert_eq!( - micromark("#### foo"), + to_html("#### foo"), "<h4>foo</h4>", "should support a heading w/ rank 4" ); assert_eq!( - micromark("##### foo"), + to_html("##### foo"), "<h5>foo</h5>", "should support a heading w/ rank 5" ); assert_eq!( - micromark("###### foo"), + to_html("###### foo"), "<h6>foo</h6>", "should support a heading w/ rank 6" ); assert_eq!( - micromark("####### foo"), + to_html("####### foo"), "<p>####### foo</p>", "should not support a heading w/ rank 7" ); assert_eq!( - micromark("#5 bolt"), + to_html("#5 bolt"), "<p>#5 bolt</p>", "should not support a heading for a number sign not followed by whitespace (1)" ); assert_eq!( - micromark("#hashtag"), + to_html("#hashtag"), "<p>#hashtag</p>", "should not support a heading for a number sign not followed by whitespace (2)" ); assert_eq!( - micromark("\\## foo"), + to_html("\\## foo"), "<p>## foo</p>", "should not support a heading for an escaped number sign" ); assert_eq!( - micromark("# foo *bar* \\*baz\\*"), + to_html("# foo *bar* \\*baz\\*"), "<h1>foo <em>bar</em> *baz*</h1>", "should support text content in headings" ); assert_eq!( - micromark("# foo "), + to_html("# foo "), "<h1>foo</h1>", "should support arbitrary initial and final whitespace" ); assert_eq!( - micromark(" ### foo"), + to_html(" ### foo"), "<h3>foo</h3>", "should support an initial space" ); assert_eq!( - micromark(" ## foo"), + to_html(" ## foo"), "<h2>foo</h2>", "should support two initial spaces" ); assert_eq!( - micromark(" # foo"), + to_html(" # foo"), "<h1>foo</h1>", "should support three initial spaces" ); assert_eq!( - micromark(" # foo"), + to_html(" # foo"), "<pre><code># foo\n</code></pre>", "should not support four initial spaces" ); assert_eq!( - micromark("foo\n # bar"), + to_html("foo\n # bar"), "<p>foo\n# bar</p>", "should not support four initial spaces when interrupting" ); assert_eq!( - micromark("## foo ##"), + to_html("## foo ##"), "<h2>foo</h2>", "should support a closing sequence (1)" ); assert_eq!( - micromark(" ### bar ###"), + to_html(" ### bar ###"), "<h3>bar</h3>", "should support a closing sequence (2)" ); assert_eq!( - micromark("# foo ##################################"), + to_html("# foo ##################################"), "<h1>foo</h1>", "should support a closing sequence w/ an arbitrary number of number signs (1)" ); assert_eq!( - micromark("##### foo ##"), + to_html("##### foo ##"), "<h5>foo</h5>", "should support a closing sequence w/ an arbitrary number of number signs (2)" ); assert_eq!( - micromark("### foo ### "), + to_html("### foo ### "), "<h3>foo</h3>", "should support trailing whitespace after a closing sequence" ); assert_eq!( - micromark("### foo ### b"), + to_html("### foo ### b"), "<h3>foo ### b</h3>", "should not support other content after a closing sequence" ); assert_eq!( - micromark("# foo#"), + to_html("# foo#"), "<h1>foo#</h1>", "should not support a closing sequence w/o whitespace before it" ); assert_eq!( - micromark("### foo \\###"), + to_html("### foo \\###"), "<h3>foo ###</h3>", "should not support an “escaped” closing sequence (1)" ); assert_eq!( - micromark("## foo #\\##"), + to_html("## foo #\\##"), "<h2>foo ###</h2>", "should not support an “escaped” closing sequence (2)" ); assert_eq!( - micromark("# foo \\#"), + to_html("# foo \\#"), "<h1>foo #</h1>", "should not support an “escaped” closing sequence (3)" ); assert_eq!( - micromark("****\n## foo\n****"), + to_html("****\n## foo\n****"), "<hr />\n<h2>foo</h2>\n<hr />", "should support atx headings when not surrounded by blank lines" ); assert_eq!( - micromark("Foo bar\n# baz\nBar foo"), + to_html("Foo bar\n# baz\nBar foo"), "<p>Foo bar</p>\n<h1>baz</h1>\n<p>Bar foo</p>", "should support atx headings interrupting paragraphs" ); assert_eq!( - micromark("## \n#\n### ###"), + to_html("## \n#\n### ###"), "<h2></h2>\n<h1></h1>\n<h3></h3>", "should support empty atx headings (1)" ); assert_eq!( - micromark("#\na\n# b"), + to_html("#\na\n# b"), "<h1></h1>\n<p>a</p>\n<h1>b</h1>", "should support empty atx headings (2)" ); assert_eq!( - micromark("> #\na"), + to_html("> #\na"), "<blockquote>\n<h1></h1>\n</blockquote>\n<p>a</p>", "should not support lazyness (1)" ); assert_eq!( - micromark("> a\n#"), + to_html("> a\n#"), "<blockquote>\n<p>a</p>\n</blockquote>\n<h1></h1>", "should not support lazyness (2)" ); assert_eq!( - micromark_with_options( + to_html_with_options( "# a", &Options { parse: ParseOptions { @@ -226,7 +226,7 @@ fn heading_atx() -> Result<(), String> { ); assert_eq!( - micromark_to_mdast("## alpha #", &ParseOptions::default())?, + to_mdast("## alpha #", &ParseOptions::default())?, Node::Root(Root { children: vec![Node::Heading(Heading { depth: 2, |