Skip to content

Commit

Permalink
Preserve non-ASCII whitespace in test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus Klaas de Vries authored and marcusklaas committed Sep 8, 2021
1 parent 054f22c commit 5088b21
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/firstpass.rs
Expand Up @@ -1237,12 +1237,12 @@ fn scan_paragraph_interrupt(bytes: &[u8]) -> bool {

/// Assumes `text_bytes` is preceded by `<`.
fn get_html_end_tag(text_bytes: &[u8]) -> Option<&'static str> {
static BEGIN_TAGS: &[&[u8]; 3] = &[b"pre", b"style", b"script"];
static BEGIN_TAGS: &[&[u8]; 4] = &[b"pre", b"style", b"script", b"textarea"];
static ST_BEGIN_TAGS: &[&[u8]; 3] = &[b"!--", b"?", b"![CDATA["];

for (beg_tag, end_tag) in BEGIN_TAGS
.iter()
.zip(["</pre>", "</style>", "</script>"].iter())
.zip(["</pre>", "</style>", "</script>", "</textarea>"].iter())
{
let tag_len = beg_tag.len();

Expand Down
16 changes: 8 additions & 8 deletions tests/suite/spec.rs
Expand Up @@ -319,7 +319,7 @@ fn spec_test_25() {
&frac34; &HilbertSpace; &DifferentialD;
&ClockwiseContourIntegral; &ngE;
"##;
let expected = r##"<p> &amp; © Æ Ď
let expected = r##"<p>  &amp; © Æ Ď
¾ ℋ ⅆ
∲ ≧̸</p>
"##;
Expand Down Expand Up @@ -5070,20 +5070,20 @@ fn spec_test_332() {

#[test]
fn spec_test_333() {
let original = r##"` b `
let original = r##"` b `
"##;
let expected = r##"<p><code> b </code></p>
let expected = r##"<p><code> b </code></p>
"##;

test_markdown_html(original, expected, false);
}

#[test]
fn spec_test_334() {
let original = r##"` `
let original = r##"` `
` `
"##;
let expected = r##"<p><code> </code>
let expected = r##"<p><code> </code>
<code> </code></p>
"##;

Expand Down Expand Up @@ -5279,9 +5279,9 @@ fn spec_test_352() {

#[test]
fn spec_test_353() {
let original = r##"* a *
let original = r##"* a *
"##;
let expected = r##"<p>* a *</p>
let expected = r##"<p>* a *</p>
"##;

test_markdown_html(original, expected, false);
Expand Down Expand Up @@ -6839,7 +6839,7 @@ fn spec_test_505() {

#[test]
fn spec_test_506() {
let original = r##"[link](/url "title")
let original = r##"[link](/url "title")
"##;
let expected = r##"<p><a href="/url%C2%A0%22title%22">link</a></p>
"##;
Expand Down
16 changes: 8 additions & 8 deletions third_party/CommonMark/spec.txt
Expand Up @@ -644,7 +644,7 @@ references and their corresponding code points.
&frac34; &HilbertSpace; &DifferentialD;
&ClockwiseContourIntegral; &ngE;
.
<p> &amp; © Æ Ď
<p>  &amp; © Æ Ď
¾ ℋ ⅆ
∲ ≧̸</p>
````````````````````````````````
Expand Down Expand Up @@ -5927,18 +5927,18 @@ Only [spaces], and not [unicode whitespace] in general, are
stripped in this way:

```````````````````````````````` example
` b `
` b `
.
<p><code> b </code></p>
<p><code> b </code></p>
````````````````````````````````

No stripping occurs if the code span contains only spaces:

```````````````````````````````` example
` `
` `
` `
.
<p><code> </code>
<p><code> </code>
<code> </code></p>
````````````````````````````````

Expand Down Expand Up @@ -6332,9 +6332,9 @@ a*"foo"*
Unicode nonbreaking spaces count as whitespace, too:

```````````````````````````````` example
* a *
* a *
.
<p>* a *</p>
<p>* a *</p>
````````````````````````````````


Expand Down Expand Up @@ -7755,7 +7755,7 @@ ending.
Other [Unicode whitespace] like non-breaking space doesn't work.

```````````````````````````````` example
[link](/url "title")
[link](/url "title")
.
<p><a href="/url%C2%A0%22title%22">link</a></p>
````````````````````````````````
Expand Down

0 comments on commit 5088b21

Please sign in to comment.