3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-21 15:42:58 +01:00

Return a result where a conversion's text would pass the engine's longest string

This commit is contained in:
2026-10-11 20:30:42 +02:00
committed by Lillem4n
parent 0b3f6e8973
commit a9331b4125
14 changed files with 105 additions and 30 deletions
@@ -70,6 +70,12 @@ test('refuses what the document guard refuses, and nothing else', () => {
assert.match(portableDocument(document(paragraph(deepInline))), /^unsupported-nesting-depth at /)
})
test('refuses a document whose text merges past the engine\'s longest string', () => {
const long = 'a'.repeat(2 ** 28)
const merged = paragraph(...Array.from({ length: 9 }, () => text(long)))
assert.equal(portableDocument(document(merged)), 'unsupported-node-shape at /')
})
test('refuses nesting past 500 levels wherever the reduction walks', () => {
const lowest = (bottom: AdfNode): string => {
let deep = bottom