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/autolink.rs | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'tests/autolink.rs') diff --git a/tests/autolink.rs b/tests/autolink.rs index d2b0956..1b20e08 100644 --- a/tests/autolink.rs +++ b/tests/autolink.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, CompileOptions, Constructs, Options, ParseOptions, }; @@ -19,241 +19,241 @@ fn autolink() -> Result<(), String> { }; assert_eq!( - micromark(""), + to_html(""), "

http://foo.bar.baz

", "should support protocol autolinks (1)" ); assert_eq!( - micromark(""), + to_html(""), "

http://foo.bar.baz/test?q=hello&id=22&boolean

", "should support protocol autolinks (2)" ); assert_eq!( - micromark(""), + to_html(""), "

irc://foo.bar:2233/baz

", "should support protocol autolinks w/ non-HTTP schemes" ); assert_eq!( - micromark(""), + to_html(""), "

MAILTO:FOO@BAR.BAZ

", "should support protocol autolinks in uppercase" ); assert_eq!( - micromark(""), + to_html(""), "

a+b+c:d

", "should support protocol autolinks w/ incorrect URIs (1, default)" ); assert_eq!( - micromark_with_options("", &danger)?, + to_html_with_options("", &danger)?, "

a+b+c:d

", "should support protocol autolinks w/ incorrect URIs (1, danger)" ); assert_eq!( - micromark(""), + to_html(""), "

made-up-scheme://foo,bar

", "should support protocol autolinks w/ incorrect URIs (2, default)" ); assert_eq!( - micromark_with_options("", &danger)?, + to_html_with_options("", &danger)?, "

made-up-scheme://foo,bar

", "should support protocol autolinks w/ incorrect URIs (2, danger)" ); assert_eq!( - micromark(""), + to_html(""), "

http://../

", "should support protocol autolinks w/ incorrect URIs (3)" ); assert_eq!( - micromark_with_options("", &danger)?, + to_html_with_options("", &danger)?, "

localhost:5001/foo

", "should support protocol autolinks w/ incorrect URIs (4)" ); assert_eq!( - micromark(""), + to_html(""), "

<http://foo.bar/baz bim>

", "should not support protocol autolinks w/ spaces" ); assert_eq!( - micromark(""), + to_html(""), "

http://example.com/\\[\\

", "should not support character escapes in protocol autolinks" ); assert_eq!( - micromark(""), + to_html(""), "

foo@bar.example.com

", "should support email autolinks (1)" ); assert_eq!( - micromark(""), + to_html(""), "

foo+special@Bar.baz-bar0.com

", "should support email autolinks (2)" ); assert_eq!( - micromark(""), + to_html(""), "

a@b.c

", "should support email autolinks (3)" ); assert_eq!( - micromark(""), + to_html(""), "

<foo+@bar.example.com>

", "should not support character escapes in email autolinks" ); assert_eq!( - micromark("<>"), + to_html("<>"), "

<>

", "should not support empty autolinks" ); assert_eq!( - micromark("< http://foo.bar >"), + to_html("< http://foo.bar >"), "

< http://foo.bar >

", "should not support autolinks w/ space" ); assert_eq!( - micromark(""), + to_html(""), "

<m:abc>

", "should not support autolinks w/ a single character for a scheme" ); assert_eq!( - micromark(""), + to_html(""), "

<foo.bar.baz>

", "should not support autolinks w/o a colon or at sign" ); assert_eq!( - micromark("http://example.com"), + to_html("http://example.com"), "

http://example.com

", "should not support protocol autolinks w/o angle brackets" ); assert_eq!( - micromark("foo@bar.example.com"), + to_html("foo@bar.example.com"), "

foo@bar.example.com

", "should not support email autolinks w/o angle brackets" ); // Extra: assert_eq!( - micromark("<*@example.com>"), + to_html("<*@example.com>"), "

*@example.com

", "should support autolinks w/ atext (1)" ); assert_eq!( - micromark(""), + to_html(""), "

a*@example.com

", "should support autolinks w/ atext (2)" ); assert_eq!( - micromark(""), + to_html(""), "

aa*@example.com

", "should support autolinks w/ atext (3)" ); assert_eq!( - micromark(""), + to_html(""), "

<aaa©@example.com>

", "should support non-atext in email autolinks local part (1)" ); assert_eq!( - micromark(""), + to_html(""), "

<a*a©@example.com>

", "should support non-atext in email autolinks local part (2)" ); assert_eq!( - micromark(""), + to_html(""), "

<asd@.example.com>

", "should not support a dot after an at sign in email autolinks" ); assert_eq!( - micromark(""), + to_html(""), "

<asd@e..xample.com>

", "should not support a dot after another dot in email autolinks" ); assert_eq!( - micromark( + to_html( ""), "

asd@012345678901234567890123456789012345678901234567890123456789012

", "should support 63 character in email autolinks domains" ); assert_eq!( - micromark(""), + to_html(""), "

<asd@0123456789012345678901234567890123456789012345678901234567890123>

", "should not support 64 character in email autolinks domains" ); assert_eq!( - micromark( + to_html( ""), "

asd@012345678901234567890123456789012345678901234567890123456789012.a

", "should support a TLD after a 63 character domain in email autolinks" ); assert_eq!( - micromark(""), + to_html(""), "

<asd@0123456789012345678901234567890123456789012345678901234567890123.a>

", "should not support a TLD after a 64 character domain in email autolinks" ); assert_eq!( - micromark( + to_html( ""), "

asd@a.012345678901234567890123456789012345678901234567890123456789012

", "should support a 63 character TLD in email autolinks" ); assert_eq!( - micromark(""), + to_html(""), "

<asd@a.0123456789012345678901234567890123456789012345678901234567890123>

", "should not support a 64 character TLD in email autolinks" ); assert_eq!( - micromark(""), + to_html(""), "

<asd@-example.com>

", "should not support a dash after `@` in email autolinks" ); assert_eq!( - micromark(""), + to_html(""), "

asd@e-xample.com

", "should support a dash after other domain characters in email autolinks" ); assert_eq!( - micromark(""), + to_html(""), "

asd@e--xample.com

", "should support a dash after another dash in email autolinks" ); assert_eq!( - micromark(""), + to_html(""), "

<asd@example-.com>

", "should not support a dash before a dot in email autolinks" ); assert_eq!( - micromark_with_options( + to_html_with_options( "", &Options { parse: ParseOptions { @@ -271,7 +271,7 @@ fn autolink() -> Result<(), String> { ); assert_eq!( - micromark_to_mdast( + to_mdast( "a b c.", &ParseOptions::default() )?, -- cgit