3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-18 06:05:43 +01:00

Answer stability round 2: 0 🔴, 1 🟡 (0 misread); the nesting-limit test asserts the limit in the message, not the sentence

This commit is contained in:
2026-11-14 22:09:03 +01:00
committed by Lillem4n
parent 33d5edf9b2
commit 23eaeecb6c
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -402,7 +402,9 @@ const refusedDocuments: Record<string, AdfDocument> = {
}
test('gives the limit in the message of a document nested too deep', () => {
assert.equal(plain(adfToPlainText(document(deepQuote(largestNesting + 1)))), `unsupported-nesting-depth: the document nests deeper than the ${largestNesting} levels the writer carries`)
const written = plain(adfToPlainText(document(deepQuote(largestNesting + 1))))
assert.equal(written.startsWith('unsupported-nesting-depth: '), true)
assert.equal(written.includes(String(largestNesting)), true)
})
for (const [name, input] of Object.entries(refusedDocuments)) {
+1 -1
View File
@@ -17,7 +17,7 @@ type Step =
| { depth: number; kind: 'node'; marker: string | undefined; node: AdfNode; place: Place | undefined; suffix: string | undefined }
| { kind: 'separator' }
// The text written so far. `pieces`: its heads and bodies, `length` their total; `gap`: the line feeds the layout owes before the next text at least, and `literal` those the text before ended in, of which the larger is written; `lead`: the marker of the item the next text opens; `indent`: the margin of every line after that; `cell`: the table cell being written.
// The text written so far. `pieces`: the text in order, `length` its total; `gap`: the line feeds the layout owes before the next text at least, and `literal` the line feeds the text before it ended in, of which the larger count is written; `lead`: the marker of the item the next text opens; `indent`: the margin of every line after that; `cell`: the table cell being written.
type Writing = { cell: Cell | undefined; gap: number; indent: string; lead: string | undefined; length: number; literal: number; pieces: string[] }
// A table cell being written: its text goes on the row's line, without the row's margin; `start` is the `length` where the cell began, and `owed` the line feeds owed there, the only ones its first text may write.