mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-21 07:32:58 +01:00
Spell a line in memory linear in its length, so a paragraph up to V8's longest string converts within Node's default heap
This commit is contained in:
@@ -70,6 +70,12 @@ test('refuses text past V8\'s longest string', () => {
|
||||
assert.equal(markdown(result), tooLong)
|
||||
})
|
||||
|
||||
// One escape past the most entries V8's Set holds.
|
||||
test('escapes more characters in a line than a Set holds', () => {
|
||||
const stars = '*'.repeat(2 ** 24 + 1)
|
||||
assert.equal(markdown(adfToLosslessMarkdown(document(paragraph({ text: stars, type: 'text' })))), `${'\\*'.repeat(2 ** 24 + 1)}\n`)
|
||||
})
|
||||
|
||||
test('refuses a document version the markdown cannot carry', () => {
|
||||
assert.equal(code(adfToLosslessMarkdown({ type: 'doc', version: 2 })), 'unsupported-document-version')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user