From b00fafbdcba39e7e17144b07834702629b891062 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 14 Jun 2022 18:57:28 +0200 Subject: Fix support for deep subtokenization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix a couple of forgotten line ending handling in html (text) * Fix missing initial case for html (text) not having a `<` 😬 * Add line ending handling to `text` construct --- tests/html_text.rs | 108 +++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 58 deletions(-) (limited to 'tests/html_text.rs') diff --git a/tests/html_text.rs b/tests/html_text.rs index 6ec387b..1f85ac4 100644 --- a/tests/html_text.rs +++ b/tests/html_text.rs @@ -26,22 +26,20 @@ fn html_text() { "should support self-closing tags" ); - // To do: line endings. - // assert_eq!( - // micromark_with_options("", DANGER), - // "

", - // "should support whitespace in tags" - // ); + assert_eq!( + micromark_with_options("", DANGER), + "

", + "should support whitespace in tags" + ); - // To do: line endings. - // assert_eq!( - // micromark_with_options( - // "\"\"\n_boolean zoop:33=zoop:33 />", - // DANGER - // ), - // "

\"\"\n_boolean zoop:33=zoop:33 />

", - // "should support attributes on tags" - // ); + assert_eq!( + micromark_with_options( + "", + DANGER + ), + "

", + "should support attributes on tags" + ); assert_eq!( micromark_with_options("Foo ", DANGER), @@ -67,12 +65,11 @@ fn html_text() { "should not support nonconforming attribute values" ); - // To do: line endings. - // assert_eq!( - // micromark_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("< a><\nfoo>\n", DANGER), + "

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

", + "should not support nonconforming whitespace" + ); assert_eq!( micromark_with_options("
", DANGER), @@ -92,12 +89,11 @@ fn html_text() { "should not support closing tags w/ attributes" ); - // To do: line endings. - // assert_eq!( - // micromark_with_options("foo ", DANGER), - // "

foo

", - // "should support comments" - // ); + assert_eq!( + micromark_with_options("foo ", DANGER), + "

foo

", + "should support comments" + ); assert_eq!( micromark_with_options("foo ", DANGER), @@ -384,12 +380,11 @@ fn html_text() { "should not support eof in unquoted attribute value" ); - // To do: line endings. - // assert_eq!( - // micromark_with_options("foo
", DANGER), - // "

foo

", - // "should support an eol before an attribute value" - // ); + assert_eq!( + micromark_with_options("foo ", DANGER), + "

foo

", + "should support an eol before an attribute value" + ); assert_eq!( micromark_with_options(" a", DANGER), @@ -403,32 +398,29 @@ micromark_with_options(" a", DANGER), "should support an EOF before an attribute value" ); - // To do: line endings. - // assert_eq!( - // micromark_with_options("a ", DANGER), - // "

a

", - // "should support an EOL in a declaration" - // ); - // To do: line endings. - // assert_eq!( - // micromark_with_options("a ", DANGER), - // "

a

", - // "should support an EOL in cdata" - // ); + assert_eq!( + micromark_with_options("a ", DANGER), + "

a

", + "should support an EOL in a declaration" + ); + assert_eq!( + micromark_with_options("a ", DANGER), + "

a

", + "should support an EOL in cdata" + ); - // To do: line endings. - // // Note: cmjs parses this differently. - // // See: + // Note: cmjs parses this differently. + // See: + assert_eq!( + micromark_with_options("a ", DANGER), + "

a

", + "should support an EOL in an instruction" + ); + + // To do: extensions. // assert_eq!( - // micromark_with_options("a ", DANGER), - // "

a

", - // "should support an EOL in an instruction" + // micromark_with_options("a ", {extensions: [{disable: {null: ["htmlText"]}}]}), + // "

a <x>

", + // "should support turning off html (text)" // ); - - // // To do: extensions. - // // assert_eq!( - // // micromark_with_options("a ", {extensions: [{disable: {null: ["htmlText"]}}]}), - // // "

a <x>

", - // // "should support turning off html (text)" - // // ); } -- cgit