aboutsummaryrefslogtreecommitdiffstats
path: root/tests/character_reference.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-13 10:40:01 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-13 10:40:01 +0200
commitec2d1bfb4232178fb3a6cba36f138bc6efbbf34a (patch)
tree2da4be3be22c2324c48cb17133b3f4b26b9139d2 /tests/character_reference.rs
parent861af95c119721e814460fa7dc32bd3d74b38484 (diff)
downloadmarkdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.gz
markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.bz2
markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.zip
Rename crate to `markdown`
Diffstat (limited to '')
-rw-r--r--tests/character_reference.rs68
1 files changed, 34 insertions, 34 deletions
diff --git a/tests/character_reference.rs b/tests/character_reference.rs
index 4e9a436..2d5c6df 100644
--- a/tests/character_reference.rs
+++ b/tests/character_reference.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{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,
};
@@ -10,7 +10,7 @@ use pretty_assertions::assert_eq;
#[test]
fn character_reference() -> Result<(), String> {
assert_eq!(
- micromark(
+ to_html(
"&nbsp; &amp; &copy; &AElig; &Dcaron;\n&frac34; &HilbertSpace; &DifferentialD;\n&ClockwiseContourIntegral; &ngE;"
),
"<p>\u{a0} &amp; © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸</p>",
@@ -18,38 +18,38 @@ fn character_reference() -> Result<(), String> {
);
assert_eq!(
- micromark("&#35; &#1234; &#992; &#0;"),
+ to_html("&#35; &#1234; &#992; &#0;"),
"<p># Ӓ Ϡ �</p>",
"should support decimal character references"
);
assert_eq!(
- micromark("&#X22; &#XD06; &#xcab;"),
+ to_html("&#X22; &#XD06; &#xcab;"),
"<p>&quot; ആ ಫ</p>",
"should support hexadecimal character references"
);
assert_eq!(
- micromark(
+ to_html(
"&nbsp &x; &#; &#x;\n&#987654321;\n&#abcdef0;\n&ThisIsNotDefined; &hi?;"),
"<p>&amp;nbsp &amp;x; &amp;#; &amp;#x;\n&amp;#987654321;\n&amp;#abcdef0;\n&amp;ThisIsNotDefined; &amp;hi?;</p>",
"should not support other things that look like character references"
);
assert_eq!(
- micromark("&copy"),
+ to_html("&copy"),
"<p>&amp;copy</p>",
"should not support character references w/o semicolon"
);
assert_eq!(
- micromark("&MadeUpEntity;"),
+ to_html("&MadeUpEntity;"),
"<p>&amp;MadeUpEntity;</p>",
"should not support unknown named character references"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<a href=\"&ouml;&ouml;.html\">",
&Options {
compile: CompileOptions {
@@ -65,140 +65,140 @@ fn character_reference() -> Result<(), String> {
);
assert_eq!(
- micromark("[foo](/f&ouml;&ouml; \"f&ouml;&ouml;\")"),
+ to_html("[foo](/f&ouml;&ouml; \"f&ouml;&ouml;\")"),
"<p><a href=\"/f%C3%B6%C3%B6\" title=\"föö\">foo</a></p>",
"should support character references in resource URLs and titles"
);
assert_eq!(
- micromark("[foo]: /f&ouml;&ouml; \"f&ouml;&ouml;\"\n\n[foo]"),
+ to_html("[foo]: /f&ouml;&ouml; \"f&ouml;&ouml;\"\n\n[foo]"),
"<p><a href=\"/f%C3%B6%C3%B6\" title=\"föö\">foo</a></p>",
"should support character references in definition URLs and titles"
);
assert_eq!(
- micromark("``` f&ouml;&ouml;\nfoo\n```"),
+ to_html("``` f&ouml;&ouml;\nfoo\n```"),
"<pre><code class=\"language-föö\">foo\n</code></pre>",
"should support character references in code language"
);
assert_eq!(
- micromark("`f&ouml;&ouml;`"),
+ to_html("`f&ouml;&ouml;`"),
"<p><code>f&amp;ouml;&amp;ouml;</code></p>",
"should not support character references in text code"
);
assert_eq!(
- micromark(" f&ouml;f&ouml;"),
+ to_html(" f&ouml;f&ouml;"),
"<pre><code>f&amp;ouml;f&amp;ouml;\n</code></pre>",
"should not support character references in indented code"
);
assert_eq!(
- micromark("&#42;foo&#42;\n*foo*"),
+ to_html("&#42;foo&#42;\n*foo*"),
"<p>*foo*\n<em>foo</em></p>",
"should not support character references as construct markers (1)"
);
assert_eq!(
- micromark("&#42; foo\n\n* foo"),
+ to_html("&#42; foo\n\n* foo"),
"<p>* foo</p>\n<ul>\n<li>foo</li>\n</ul>",
"should not support character references as construct markers (2)"
);
assert_eq!(
- micromark("[a](url &quot;tit&quot;)"),
+ to_html("[a](url &quot;tit&quot;)"),
"<p>[a](url &quot;tit&quot;)</p>",
"should not support character references as construct markers (3)"
);
assert_eq!(
- micromark("foo&#10;&#10;bar"),
+ to_html("foo&#10;&#10;bar"),
"<p>foo\n\nbar</p>",
"should not support character references as whitespace (1)"
);
assert_eq!(
- micromark("&#9;foo"),
+ to_html("&#9;foo"),
"<p>\tfoo</p>",
"should not support character references as whitespace (2)"
);
// Extra:
assert_eq!(
- micromark("&CounterClockwiseContourIntegral;"),
+ to_html("&CounterClockwiseContourIntegral;"),
"<p>∳</p>",
"should support the longest possible named character reference"
);
assert_eq!(
- micromark("&#xff9999;"),
+ to_html("&#xff9999;"),
"<p>�</p>",
"should “support” a longest possible hexadecimal character reference"
);
assert_eq!(
- micromark("&#9999999;"),
+ to_html("&#9999999;"),
"<p>�</p>",
"should “support” a longest possible decimal character reference"
);
assert_eq!(
- micromark("&CounterClockwiseContourIntegrali;"),
+ to_html("&CounterClockwiseContourIntegrali;"),
"<p>&amp;CounterClockwiseContourIntegrali;</p>",
"should not support the longest possible named character reference"
);
assert_eq!(
- micromark("&#xff99999;"),
+ to_html("&#xff99999;"),
"<p>&amp;#xff99999;</p>",
"should not support a longest possible hexadecimal character reference"
);
assert_eq!(
- micromark("&#99999999;"),
+ to_html("&#99999999;"),
"<p>&amp;#99999999;</p>",
"should not support a longest possible decimal character reference"
);
assert_eq!(
- micromark("&-;"),
+ to_html("&-;"),
"<p>&amp;-;</p>",
"should not support the other characters after `&`"
);
assert_eq!(
- micromark("&#-;"),
+ to_html("&#-;"),
"<p>&amp;#-;</p>",
"should not support the other characters after `#`"
);
assert_eq!(
- micromark("&#x-;"),
+ to_html("&#x-;"),
"<p>&amp;#x-;</p>",
"should not support the other characters after `#x`"
);
assert_eq!(
- micromark("&lt-;"),
+ to_html("&lt-;"),
"<p>&amp;lt-;</p>",
"should not support the other characters inside a name"
);
assert_eq!(
- micromark("&#9-;"),
+ to_html("&#9-;"),
"<p>&amp;#9-;</p>",
"should not support the other characters inside a demical"
);
assert_eq!(
- micromark("&#x9-;"),
+ to_html("&#x9-;"),
"<p>&amp;#x9-;</p>",
"should not support the other characters inside a hexademical"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"&amp;",
&Options {
parse: ParseOptions {
@@ -216,7 +216,7 @@ fn character_reference() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("&nbsp; &amp; &copy; &AElig; &Dcaron;\n&frac34; &HilbertSpace; &DifferentialD;\n&ClockwiseContourIntegral; &ngE;", &ParseOptions::default())?,
+ to_mdast("&nbsp; &amp; &copy; &AElig; &Dcaron;\n&frac34; &HilbertSpace; &DifferentialD;\n&ClockwiseContourIntegral; &ngE;", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![Node::Text(Text {