Skip to content

Commit

Permalink
Add new pathological test from cmark upstream (markdown-it#1008)
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle authored Mar 1, 2024
1 parent d07d585 commit 806bead
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/pathological.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "md5": "68c7c28fe0d4a34367f27dcbceec9fed" }
{ "md5": "80e12450752e4667b3656fa2cd12e9d5" }
16 changes: 16 additions & 0 deletions test/pathological.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ describe('Pathological sequences speed', () => {
await test_pattern(Array(1000).fill(0).map(function (_, x) { return ' '.repeat(x) + '* a\n' }).join(''))
})

it('U+0000 in input', async () => {
await test_pattern('abc\u0000de\u0000'.repeat(100000))
})

it('backticks', async () => {
await test_pattern(Array(3000).fill(0).map(function (_, x) { return 'e' + '`'.repeat(x) }).join(''))
})
Expand All @@ -129,6 +133,18 @@ describe('Pathological sequences speed', () => {
it('unclosed <!--', async () => {
await test_pattern('</' + '<!--'.repeat(100000))
})

it('empty lines in deeply nested lists', async () => {
await test_pattern('- '.repeat(30000) + 'x' + '\n'.repeat(30000))
})

it('empty lines in deeply nested lists in blockquote', async () => {
await test_pattern('> ' + '- '.repeat(30000) + 'x\n' + '>\n'.repeat(30000))
})

it('emph in deep blockquote', async () => {
await test_pattern('>'.repeat(100000) + 'a*'.repeat(100000))
})
})

describe('Markdown-it', () => {
Expand Down

0 comments on commit 806bead

Please sign in to comment.