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/html_text.rs | 144 ++++++++++++++++++++++++++--------------------------- 1 file changed, 72 insertions(+), 72 deletions(-) (limited to 'tests/html_text.rs') diff --git a/tests/html_text.rs b/tests/html_text.rs index 2bdd79d..5537d3d 100644 --- a/tests/html_text.rs +++ b/tests/html_text.rs @@ -1,7 +1,7 @@ -extern crate micromark; -use micromark::{ +extern crate markdown; +use markdown::{ mdast::{Html, 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,31 +19,31 @@ fn html_text() -> Result<(), String> { }; assert_eq!( - micromark("a c"), + to_html("a c"), "

a <b> c

", "should encode dangerous html by default" ); assert_eq!( - micromark_with_options("", &danger)?, + to_html_with_options("", &danger)?, "

", "should support opening tags" ); assert_eq!( - micromark_with_options("", &danger)?, + to_html_with_options("", &danger)?, "

", "should support self-closing tags" ); assert_eq!( - micromark_with_options("", &danger)?, + to_html_with_options("", &danger)?, "

", "should support whitespace in tags" ); assert_eq!( - micromark_with_options( + to_html_with_options( "", &danger )?, @@ -52,164 +52,164 @@ fn html_text() -> Result<(), String> { ); assert_eq!( - micromark_with_options("Foo ", &danger)?, + to_html_with_options("Foo ", &danger)?, "

Foo

", "should support non-html tags" ); assert_eq!( - micromark_with_options("<33> <__>", &danger)?, + to_html_with_options("<33> <__>", &danger)?, "

<33> <__>

", "should not support nonconforming tag names" ); assert_eq!( - micromark_with_options("
", &danger)?, + to_html_with_options("", &danger)?, "

<a h*#ref="hi">

", "should not support nonconforming attribute names" ); assert_eq!( - micromark_with_options("
", &danger)?, + to_html_with_options(" ", &danger)?, "

<a href="hi'> <a href=hi'>

", "should not support nonconforming attribute values" ); assert_eq!( - micromark_with_options("< a><\nfoo>\n", &danger)?, + to_html_with_options("< a><\nfoo>\n", &danger)?, "

< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop />

", "should not support nonconforming whitespace" ); assert_eq!( - micromark_with_options("
", &danger)?, + to_html_with_options("", &danger)?, "

<a href='bar'title=title>

", "should not support missing whitespace" ); assert_eq!( - micromark_with_options("
", &danger)?, + to_html_with_options("", &danger)?, "

", "should support closing tags" ); assert_eq!( - micromark_with_options("", &danger)?, + to_html_with_options("", &danger)?, "

</a href="foo">

", "should not support closing tags w/ attributes" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo

", "should support comments" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo <!-- not a comment -- two hyphens -->

", "should not support comments w/ two dashes inside" ); assert_eq!( - micromark_with_options("foo foo -->", &danger)?, + to_html_with_options("foo foo -->", &danger)?, "

foo <!--> foo -->

", "should not support nonconforming comments (1)" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo <!-- foo--->

", "should not support nonconforming comments (2)" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo

", "should support instructions" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo

", "should support declarations" ); assert_eq!( - micromark_with_options("foo &<]]>", &danger)?, + to_html_with_options("foo &<]]>", &danger)?, "

foo &<]]>

", "should support cdata" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo

", "should support (ignore) character references" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo

", "should not support character escapes (1)" ); assert_eq!( - micromark_with_options("", &danger)?, + to_html_with_options("", &danger)?, "

<a href=""">

", "should not support character escapes (2)" ); // Extra: assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo <!1>

", "should not support non-comment, non-cdata, and non-named declaration" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo <!-not enough!-->

", "should not support comments w/ not enough dashes" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo

", "should support comments that start w/ a dash, if it’s not followed by a greater than" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo <!--->

", "should not support comments that start w/ `->`" ); assert_eq!( - micromark_with_options("foo ", &danger)?, + to_html_with_options("foo ", &danger)?, "

foo

", "should support `->` in a comment" ); assert_eq!( - micromark_with_options("foo