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/image.rs | 78 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'tests/image.rs') diff --git a/tests/image.rs b/tests/image.rs index 7b58e6d..3d53032 100644 --- a/tests/image.rs +++ b/tests/image.rs @@ -1,7 +1,7 @@ -extern crate micromark; -use micromark::{ +extern crate markdown; +use markdown::{ mdast::{Definition, Image, ImageReference, Node, Paragraph, ReferenceKind, Root, Text}, - micromark, micromark_to_mdast, micromark_with_options, + to_html, to_html_with_options, to_mdast, unist::Position, CompileOptions, Constructs, Options, ParseOptions, }; @@ -10,181 +10,181 @@ use pretty_assertions::assert_eq; #[test] fn image() -> Result<(), String> { assert_eq!( - micromark("[link](/uri \"title\")"), + to_html("[link](/uri \"title\")"), "

link

", "should support links" ); assert_eq!( - micromark("![foo](/url \"title\")"), + to_html("![foo](/url \"title\")"), "

\"foo\"

", "should support image w/ resource" ); assert_eq!( - micromark("[foo *bar*]: train.jpg \"train & tracks\"\n\n![foo *bar*]"), + to_html("[foo *bar*]: train.jpg \"train & tracks\"\n\n![foo *bar*]"), "

\"foo

", "should support image as shortcut reference" ); assert_eq!( - micromark("![foo ![bar](/url)](/url2)"), + to_html("![foo ![bar](/url)](/url2)"), "

\"foo

", "should “support” images in images" ); assert_eq!( - micromark("![foo [bar](/url)](/url2)"), + to_html("![foo [bar](/url)](/url2)"), "

\"foo

", "should “support” links in images" ); assert_eq!( - micromark("[foo *bar*]: train.jpg \"train & tracks\"\n\n![foo *bar*][]"), + to_html("[foo *bar*]: train.jpg \"train & tracks\"\n\n![foo *bar*][]"), "

\"foo

", "should support “content” in images" ); assert_eq!( - micromark("[FOOBAR]: train.jpg \"train & tracks\"\n\n![foo *bar*][foobar]"), + to_html("[FOOBAR]: train.jpg \"train & tracks\"\n\n![foo *bar*][foobar]"), "

\"foo

", "should support “content” in images" ); assert_eq!( - micromark("![foo](train.jpg)"), + to_html("![foo](train.jpg)"), "

\"foo\"

", "should support images w/o title" ); assert_eq!( - micromark("My ![foo bar](/path/to/train.jpg \"title\" )"), + to_html("My ![foo bar](/path/to/train.jpg \"title\" )"), "

My \"foo

", "should support images w/ lots of whitespace" ); assert_eq!( - micromark("![foo]()"), + to_html("![foo]()"), "

\"foo\"

", "should support images w/ enclosed destinations" ); assert_eq!( - micromark("![](/url)"), + to_html("![](/url)"), "

\"\"

", "should support images w/ empty labels" ); assert_eq!( - micromark("[bar]: /url\n\n![foo][bar]"), + to_html("[bar]: /url\n\n![foo][bar]"), "

\"foo\"

", "should support full references (1)" ); assert_eq!( - micromark("[BAR]: /url\n\n![foo][bar]"), + to_html("[BAR]: /url\n\n![foo][bar]"), "

\"foo\"

", "should support full references (2)" ); assert_eq!( - micromark("[foo]: /url \"title\"\n\n![foo][]"), + to_html("[foo]: /url \"title\"\n\n![foo][]"), "

\"foo\"

", "should support collapsed references (1)" ); assert_eq!( - micromark("[*foo* bar]: /url \"title\"\n\n![*foo* bar][]"), + to_html("[*foo* bar]: /url \"title\"\n\n![*foo* bar][]"), "

\"foo

", "should support collapsed references (2)" ); assert_eq!( - micromark("[foo]: /url \"title\"\n\n![Foo][]"), + to_html("[foo]: /url \"title\"\n\n![Foo][]"), "

\"Foo\"

", "should support case-insensitive labels" ); assert_eq!( - micromark("[foo]: /url \"title\"\n\n![foo] \n[]"), + to_html("[foo]: /url \"title\"\n\n![foo] \n[]"), "

\"foo\"\n[]

", "should not support whitespace between sets of brackets" ); assert_eq!( - micromark("[foo]: /url \"title\"\n\n![foo]"), + to_html("[foo]: /url \"title\"\n\n![foo]"), "

\"foo\"

", "should support shortcut references (1)" ); assert_eq!( - micromark("[*foo* bar]: /url \"title\"\n\n![*foo* bar]"), + to_html("[*foo* bar]: /url \"title\"\n\n![*foo* bar]"), "

\"foo

", "should support shortcut references (2)" ); assert_eq!( - micromark("[[foo]]: /url \"title\"\n\n![[foo]]"), + to_html("[[foo]]: /url \"title\"\n\n![[foo]]"), "

[[foo]]: /url "title"

\n

![[foo]]

", "should not support link labels w/ unescaped brackets" ); assert_eq!( - micromark("[foo]: /url \"title\"\n\n![Foo]"), + to_html("[foo]: /url \"title\"\n\n![Foo]"), "

\"Foo\"

", "should support case-insensitive label matching" ); assert_eq!( - micromark("[foo]: /url \"title\"\n\n!\\[foo]"), + to_html("[foo]: /url \"title\"\n\n!\\[foo]"), "

![foo]

", "should “support” an escaped bracket instead of an image" ); assert_eq!( - micromark("[foo]: /url \"title\"\n\n\\![foo]"), + to_html("[foo]: /url \"title\"\n\n\\![foo]"), "

!foo

", "should support an escaped bang instead of an image, but still have a link" ); // Extra assert_eq!( - micromark("![foo]()"), + to_html("![foo]()"), "

\"foo\"

", "should support images w/o destination" ); assert_eq!( - micromark("![foo](<>)"), + to_html("![foo](<>)"), "

\"foo\"

", "should support images w/ explicit empty destination" ); assert_eq!( - micromark("![](example.png)"), + to_html("![](example.png)"), "

\"\"

", "should support images w/o alt" ); assert_eq!( - micromark("![alpha](bravo.png \"\")"), + to_html("![alpha](bravo.png \"\")"), "

\"alpha\"

", "should support images w/ empty title (1)" ); assert_eq!( - micromark("![alpha](bravo.png '')"), + to_html("![alpha](bravo.png '')"), "

\"alpha\"

", "should support images w/ empty title (2)" ); assert_eq!( - micromark("![alpha](bravo.png ())"), + to_html("![alpha](bravo.png ())"), "

\"alpha\"

", "should support images w/ empty title (3)" ); assert_eq!( - micromark("![&©&](example.com/&©& \"&©&\")"), + to_html("![&©&](example.com/&©& \"&©&\")"), "

\"&©&\"

", "should support character references in images" ); @@ -192,13 +192,13 @@ fn image() -> Result<(), String> { // Extra // See: assert_eq!( - micromark("![](<> \"\")"), + to_html("![](<> \"\")"), "

\"\"

", "should ignore an empty title" ); assert_eq!( - micromark_with_options( + to_html_with_options( "![x]()", &Options { parse: ParseOptions { @@ -216,13 +216,13 @@ fn image() -> Result<(), String> { ); assert_eq!( - micromark("![](javascript:alert(1))"), + to_html("![](javascript:alert(1))"), "

\"\"

", "should ignore non-http protocols by default" ); assert_eq!( - micromark_with_options( + to_html_with_options( "![](javascript:alert(1))", &Options { compile: CompileOptions { @@ -237,7 +237,7 @@ fn image() -> Result<(), String> { ); assert_eq!( - micromark_to_mdast( + to_mdast( "a ![alpha]() b ![bravo](charlie 'delta') c.", &ParseOptions::default() )?, @@ -277,7 +277,7 @@ fn image() -> Result<(), String> { ); assert_eq!( - micromark_to_mdast( + to_mdast( "[x]: y\n\na ![x] b ![x][] c ![d][x] e.", &ParseOptions::default() )?, -- cgit