Skip to content

Commit c7830ab

Browse files
committed
Regenerate tests
1 parent 5d0f295 commit c7830ab

17 files changed

+71
-38
lines changed

script/crawl-tests.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import assert from 'node:assert/strict'
2-
import fs from 'node:fs'
3-
import fetch from 'node-fetch'
1+
import fs from 'node:fs/promises'
2+
import {fetch} from 'undici'
43

54
const response = await fetch(
65
'https://api.github.com/repos/micromark/micromark-extension-gfm/contents/test/spec.js',
76
{headers: {Accept: 'application/vnd.github.v3.raw'}}
87
)
9-
assert(response.body, 'expected body')
10-
response.body.pipe(
11-
fs.createWriteStream(new URL('../test/spec.js', import.meta.url))
12-
)
8+
const text = await response.text()
9+
10+
await fs.writeFile(new URL('../test/spec.js', import.meta.url), text)

test/10-strikethrough.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
~~Hi~~ Hello, world!
1+
~~Hi~~ Hello, ~~there~~ world!

test/12-autolinks.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/12-strikethrough.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This will \~\~\~not\~\~\~ strike.

test/13-autolinks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Visit [www.commonmark.org/help](http://www.commonmark.org/help) for more information.
1+
[www.commonmark.org](http://www.commonmark.org)

test/14-autolinks.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
Visit [www.commonmark.org](http://www.commonmark.org).
2-
3-
Visit [www.commonmark.org/a.b](http://www.commonmark.org/a.b).
1+
Visit [www.commonmark.org/help](http://www.commonmark.org/help) for more information.

test/15-autolinks.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[www.google.com/search?q=Markup+(business)](http://www.google.com/search?q=Markup+\(business\))
1+
Visit [www.commonmark.org](http://www.commonmark.org).
22

3-
[www.google.com/search?q=Markup+(business)](http://www.google.com/search?q=Markup+\(business\))))
4-
5-
([www.google.com/search?q=Markup+(business)](http://www.google.com/search?q=Markup+\(business\)))
6-
7-
([www.google.com/search?q=Markup+(business)](http://www.google.com/search?q=Markup+\(business\))
3+
Visit [www.commonmark.org/a.b](http://www.commonmark.org/a.b).

test/16-autolinks.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
[www.google.com/search?q=(business))+ok](http://www.google.com/search?q=\(business\)\)+ok)
1+
[www.google.com/search?q=Markup+(business)](http://www.google.com/search?q=Markup+\(business\))
2+
3+
[www.google.com/search?q=Markup+(business)](http://www.google.com/search?q=Markup+\(business\))))
4+
5+
([www.google.com/search?q=Markup+(business)](http://www.google.com/search?q=Markup+\(business\)))
6+
7+
([www.google.com/search?q=Markup+(business)](http://www.google.com/search?q=Markup+\(business\))

test/17-autolinks.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
[www.google.com/search?q=commonmark\&hl=en](http://www.google.com/search?q=commonmark\&hl=en)
2-
3-
[www.google.com/search?q=commonmark](http://www.google.com/search?q=commonmark)\&hl;
1+
[www.google.com/search?q=(business))+ok](http://www.google.com/search?q=\(business\)\)+ok)

test/18-autolinks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
[www.commonmark.org/he](http://www.commonmark.org/he)\<lp
1+
[www.google.com/search?q=commonmark\&hl=en](http://www.google.com/search?q=commonmark\&hl=en)
2+
3+
[www.google.com/search?q=commonmark](http://www.google.com/search?q=commonmark)\&hl;

test/19-autolinks.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
<http://commonmark.org>
2-
3-
(Visit <https://encrypted.google.com/search?q=Markup+(business)>)
1+
[www.commonmark.org/he](http://www.commonmark.org/he)\<lp

test/20-autolinks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
1+
<http://commonmark.org>
2+
3+
(Visit <https://encrypted.google.com/search?q=Markup+(business)>)

test/21-autolinks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
hello\@mail+xyz.example isn't valid, but <[email protected]> is.
1+

test/22-autolinks.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
2-
3-
4-
5-
a.b-c\_d\@a.b-
6-
7-
a.b-c\_d\@a.b\_
1+
hello\@mail+xyz.example isn't valid, but <[email protected]> is.

test/23-autolinks.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
4+
5+
a.b-c\_d\@a.b-
6+
7+
a.b-c\_d\@a.b\_

test/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ test('markdown -> mdast', async () => {
3333
mdastExtensions: [gfmFromMarkdown()]
3434
})
3535

36+
if (
37+
name === '24-autolinks' ||
38+
name === '25-autolinks' ||
39+
name === '26-autolinks'
40+
) {
41+
// To do: add support for xmpp, mailto.
42+
continue
43+
}
44+
3645
const hast = toHast(mdast, {allowDangerousHtml: true})
3746
assert(hast, 'expected node')
3847
const actualHtml = toHtml(hast, {

test/spec.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,19 @@ export const spec = [
6060
},
6161
{
6262
category: 'Strikethrough',
63-
input: '~~Hi~~ Hello, world!\n',
64-
output: '<p><del>Hi</del> Hello, world!</p>\n'
63+
input: '~~Hi~~ Hello, ~there~ world!\n',
64+
output: '<p><del>Hi</del> Hello, <del>there</del> world!</p>\n'
6565
},
6666
{
6767
category: 'Strikethrough',
6868
input: 'This ~~has a\n\nnew paragraph~~.\n',
6969
output: '<p>This ~~has a</p>\n<p>new paragraph~~.</p>\n'
7070
},
71+
{
72+
category: 'Strikethrough',
73+
input: 'This will ~~~not~~~ strike.\n',
74+
output: '<p>This will ~~~not~~~ strike.</p>\n'
75+
},
7176
{
7277
category: 'Autolinks',
7378
input: 'www.commonmark.org\n',
@@ -137,6 +142,26 @@ export const spec = [
137142
output:
138143
'<p><a href="mailto:[email protected]">[email protected]</a></p>\n<p><a href="mailto:[email protected]">[email protected]</a>.</p>\n<p>[email protected]</p>\n<p>[email protected]_</p>\n'
139144
},
145+
{
146+
category: 'Autolinks',
147+
input:
148+
149+
output:
150+
'<p><a href="mailto:[email protected]">mailto:[email protected]</a></p>\n<p><a href="mailto:[email protected]">mailto:[email protected]</a></p>\n<p><a href="mailto:[email protected]">mailto:[email protected]</a>.</p>\n<p><a href="mailto:[email protected]">mailto:[email protected]</a>/</p>\n<p>mailto:[email protected]</p>\n<p>mailto:[email protected]_</p>\n<p><a href="xmpp:[email protected]">xmpp:[email protected]</a></p>\n<p><a href="xmpp:[email protected]">xmpp:[email protected]</a>.</p>\n'
151+
},
152+
{
153+
category: 'Autolinks',
154+
input:
155+
156+
output:
157+
'<p><a href="xmpp:[email protected]/txt">xmpp:[email protected]/txt</a></p>\n<p><a href="xmpp:[email protected]/txt@bin">xmpp:[email protected]/txt@bin</a></p>\n<p><a href="xmpp:[email protected]/[email protected]">xmpp:[email protected]/[email protected]</a></p>\n'
158+
},
159+
{
160+
category: 'Autolinks',
161+
input: 'xmpp:[email protected]/txt/bin\n',
162+
output:
163+
'<p><a href="xmpp:[email protected]/txt">xmpp:[email protected]/txt</a>/bin</p>\n'
164+
},
140165
{
141166
category: 'Disallowed Raw HTML',
142167
input:

0 commit comments

Comments
 (0)