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/gfm_autolink_literal.rs | 132 +++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 66 deletions(-) (limited to 'tests/gfm_autolink_literal.rs') diff --git a/tests/gfm_autolink_literal.rs b/tests/gfm_autolink_literal.rs index c608533..cdeecd3 100644 --- a/tests/gfm_autolink_literal.rs +++ b/tests/gfm_autolink_literal.rs @@ -1,7 +1,7 @@ -extern crate micromark; -use micromark::{ +extern crate markdown; +use markdown::{ mdast::{Link, Node, Paragraph, Root, Text}, - micromark, micromark_to_mdast, micromark_with_options, + to_html, to_html_with_options, to_mdast, unist::Position, Constructs, Options, ParseOptions, }; @@ -18,181 +18,181 @@ fn gfm_autolink_literal() -> Result<(), String> { }; assert_eq!( - micromark("https://example.com"), + to_html("https://example.com"), "

https://example.com

", "should ignore protocol urls by default" ); assert_eq!( - micromark("www.example.com"), + to_html("www.example.com"), "

www.example.com

", "should ignore www urls by default" ); assert_eq!( - micromark("user@example.com"), + to_html("user@example.com"), "

user@example.com

", "should ignore email urls by default" ); assert_eq!( - micromark_with_options("https://example.com", &gfm)?, + to_html_with_options("https://example.com", &gfm)?, "

https://example.com

", "should support protocol urls if enabled" ); assert_eq!( - micromark_with_options("www.example.com", &gfm)?, + to_html_with_options("www.example.com", &gfm)?, "

www.example.com

", "should support www urls if enabled" ); assert_eq!( - micromark_with_options("user@example.com", &gfm)?, + to_html_with_options("user@example.com", &gfm)?, "

user@example.com

", "should support email urls if enabled" ); assert_eq!( - micromark_with_options("[https://example.com](xxx)", &gfm)?, + to_html_with_options("[https://example.com](xxx)", &gfm)?, "

https://example.com

", "should not link protocol urls in links" ); assert_eq!( - micromark_with_options("[www.example.com](xxx)", &gfm)?, + to_html_with_options("[www.example.com](xxx)", &gfm)?, "

www.example.com

", "should not link www urls in links" ); assert_eq!( - micromark_with_options("[user@example.com](xxx)", &gfm)?, + to_html_with_options("[user@example.com](xxx)", &gfm)?, "

user@example.com

", "should not link email urls in links" ); assert_eq!( - micromark_with_options("user@example.com", &gfm)?, + to_html_with_options("user@example.com", &gfm)?, "

user@example.com

", "should support a closing paren at TLD (email)" ); assert_eq!( - micromark_with_options("www.a.)", &gfm)?, + to_html_with_options("www.a.)", &gfm)?, "

www.a.)

", "should support a closing paren at TLD (www)" ); assert_eq!( - micromark_with_options("www.a b", &gfm)?, + to_html_with_options("www.a b", &gfm)?, "

www.a b

", "should support no TLD" ); assert_eq!( - micromark_with_options("www.a/b c", &gfm)?, + to_html_with_options("www.a/b c", &gfm)?, "

www.a/b c

", "should support a path instead of TLD" ); assert_eq!( - micromark_with_options("www.�a", &gfm)?, + to_html_with_options("www.�a", &gfm)?, "

www.�a

", "should support a replacement character in a domain" ); assert_eq!( - micromark_with_options("http://點看.com", &gfm)?, + to_html_with_options("http://點看.com", &gfm)?, "

http://點看.com

", "should support non-ascii characters in a domain (http)" ); assert_eq!( - micromark_with_options("www.點看.com", &gfm)?, + to_html_with_options("www.點看.com", &gfm)?, "

www.點看.com

", "should support non-ascii characters in a domain (www)" ); assert_eq!( - micromark_with_options("點看@example.com", &gfm)?, + to_html_with_options("點看@example.com", &gfm)?, "

點看@example.com

", "should *not* support non-ascii characters in atext (email)" ); assert_eq!( - micromark_with_options("example@點看.com", &gfm)?, + to_html_with_options("example@點看.com", &gfm)?, "

example@點看.com

", "should *not* support non-ascii characters in a domain (email)" ); assert_eq!( - micromark_with_options("www.a.com/點看", &gfm)?, + to_html_with_options("www.a.com/點看", &gfm)?, "

www.a.com/點看

", "should support non-ascii characters in a path" ); assert_eq!( - micromark_with_options("www.-a.b", &gfm)?, + to_html_with_options("www.-a.b", &gfm)?, "

www.-a.b

", "should support a dash to start a domain" ); assert_eq!( - micromark_with_options("www.$", &gfm)?, + to_html_with_options("www.$", &gfm)?, "

www.$

", "should support a dollar as a domain name" ); assert_eq!( - micromark_with_options("www.a..b.c", &gfm)?, + to_html_with_options("www.a..b.c", &gfm)?, "

www.a..b.c

", "should support adjacent dots in a domain name" ); assert_eq!( - micromark_with_options("www.a&a;", &gfm)?, + to_html_with_options("www.a&a;", &gfm)?, "

www.a&a;

", "should support named character references in domains" ); assert_eq!( - micromark_with_options("https://a.bc/d/e/).", &gfm)?, + to_html_with_options("https://a.bc/d/e/).", &gfm)?, "

https://a.bc/d/e/).

", "should support a closing paren and period after a path" ); assert_eq!( - micromark_with_options("https://a.bc/d/e/.)", &gfm)?, + to_html_with_options("https://a.bc/d/e/.)", &gfm)?, "

https://a.bc/d/e/.)

", "should support a period and closing paren after a path" ); assert_eq!( - micromark_with_options("https://a.bc).", &gfm)?, + to_html_with_options("https://a.bc).", &gfm)?, "

https://a.bc).

", "should support a closing paren and period after a domain" ); assert_eq!( - micromark_with_options("https://a.bc.)", &gfm)?, + to_html_with_options("https://a.bc.)", &gfm)?, "

https://a.bc.)

", "should support a period and closing paren after a domain" ); assert_eq!( - micromark_with_options("https://a.bc).d", &gfm)?, + to_html_with_options("https://a.bc).d", &gfm)?, "

https://a.bc).d

", "should support a closing paren and period in a path" ); assert_eq!( - micromark_with_options("https://a.bc.)d", &gfm)?, + to_html_with_options("https://a.bc.)d", &gfm)?, "

https://a.bc.)d

", "should support a period and closing paren in a path" ); assert_eq!( - micromark_with_options("https://a.bc/))d", &gfm)?, + to_html_with_options("https://a.bc/))d", &gfm)?, "

https://a.bc/))d

", "should support two closing parens in a path" ); assert_eq!( - micromark_with_options("ftp://a/b/c.txt", &gfm)?, + to_html_with_options("ftp://a/b/c.txt", &gfm)?, "

ftp://a/b/c.txt

", "should not support ftp links" ); @@ -201,25 +201,25 @@ fn gfm_autolink_literal() -> Result<(), String> { // Fixing it would mean deviating from `cmark-gfm`: // Source: . // assert_eq!( - // micromark_with_options(",www.example.com", &gfm)?, + // to_html_with_options(",www.example.com", &gfm)?, // "

www.example.com

", // "should support www links after Unicode punctuation", // ); assert_eq!( - micromark_with_options(",https://example.com", &gfm)?, + to_html_with_options(",https://example.com", &gfm)?, "

https://example.com

", "should support http links after Unicode punctuation" ); assert_eq!( - micromark_with_options(",example@example.com", &gfm)?, + to_html_with_options(",example@example.com", &gfm)?, "

example@example.com

", "should support email links after Unicode punctuation" ); assert_eq!( - micromark_with_options( + to_html_with_options( "http://user:password@host:port/path?key=value#fragment", &gfm )?, @@ -228,13 +228,13 @@ fn gfm_autolink_literal() -> Result<(), String> { ); assert_eq!( - micromark_with_options("http://example.com/abhttp://example.com/ab<cd

", "should stop domains/paths at `<`" ); assert_eq!( - micromark_with_options( + to_html_with_options( r###" mailto:scyther@pokemon.com @@ -277,7 +277,7 @@ Email me at:scyther@pokemon.com"###, ); assert_eq!( - micromark_with_options( + to_html_with_options( r###" a www.example.com&xxx;b c @@ -326,7 +326,7 @@ a www.example.com& b // Note: this deviates from GFM, as is fixed. assert_eq!( - micromark_with_options( + to_html_with_options( r###" [ www.example.com @@ -371,7 +371,7 @@ a www.example.com& b ); assert_eq!( - micromark_with_options( + to_html_with_options( r###" www.example.com/?=a(b)cccccc @@ -422,7 +422,7 @@ www.example.com/?q=a(business))) // Here, the following issues are fixed: // - assert_eq!( - micromark_with_options( + to_html_with_options( r###" # Literal autolinks @@ -611,7 +611,7 @@ Can contain an underscore followed by a period: aaa@a.b_.c ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"H0. [https://a.com©b @@ -673,7 +673,7 @@ H5. ); assert_eq!( - micromark_with_options(r###"Image start. + to_html_with_options(r###"Image start. ![https://a.com @@ -755,7 +755,7 @@ Autolink literal after image. ); assert_eq!( - micromark_with_options(r###"Link start. + to_html_with_options(r###"Link start. [https://a.com @@ -927,7 +927,7 @@ Autolink literal after link. ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# “character reference” www.a&b (space) @@ -1040,7 +1040,7 @@ www.a&b~ ); assert_eq!( - micromark_with_options(r###"# “character reference” + to_html_with_options(r###"# “character reference” www.a# (space) @@ -1150,7 +1150,7 @@ www.a#~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"a@0.0 a@0.b @@ -1203,7 +1203,7 @@ react@0.0.0-experimental-aae83a4b9 ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# httpshhh? (2) http://a (space) @@ -1316,7 +1316,7 @@ http://a~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# httpshhh? (1) http:// (space) @@ -1429,7 +1429,7 @@ http://~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# httpshhh? (4) http://a/b (space) @@ -1542,7 +1542,7 @@ http://a/b~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# httpshhh? (3) http://a/ (space) @@ -1655,7 +1655,7 @@ http://a/~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"[www.example.com/a©](#) www.example.com/a© @@ -1681,7 +1681,7 @@ www.example.com/a\. ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# “character reference” www.a/b&c (space) @@ -1794,7 +1794,7 @@ www.a/b&c~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# “character reference” www.a/b# (space) @@ -1907,7 +1907,7 @@ www.a/b#~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"In autolink literal path or link end? [https://a.com/d]() @@ -1978,7 +1978,7 @@ www.a.com#d]() ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"Last non-markdown ASCII whitespace (FF): noreply@example.com, http://example.com, https://example.com, www.example.com Last non-whitespace ASCII control (US): noreply@example.com, http://example.com, https://example.com, www.example.com @@ -2052,7 +2052,7 @@ Some more non-ascii: 🤷‍noreply@example.com, 🤷‍http://example.com, 🤷 ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# HTTP https://a.b can start after EOF @@ -2179,7 +2179,7 @@ github.com: !a@b.c, "a@b. ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# wwwtf 2? www.a (space) @@ -2292,7 +2292,7 @@ www.a~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# wwwtf 5? www.a. (space) @@ -2405,7 +2405,7 @@ www.a.~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# wwwtf? www. (space) @@ -2518,7 +2518,7 @@ www.~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# wwwtf? (4) www.a/b (space) @@ -2631,7 +2631,7 @@ www.a/b~ ); assert_eq!( - micromark_with_options( + to_html_with_options( r###"# wwwtf? (3) www.a/ (space) @@ -2744,7 +2744,7 @@ www.a/~ ); assert_eq!( - micromark_to_mdast( + to_mdast( "a https://alpha.com b bravo@charlie.com c www.delta.com d xmpp:echo@foxtrot.com e mailto:golf@hotel.com f.", &gfm.parse )?, -- cgit