From 23eaeecb6c7d053283f71116c738a2c0974953ff Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 22:09:03 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20the=20nesti?= =?UTF-8?q?ng-limit=20test=20asserts=20the=20limit=20in=20the=20message,?= =?UTF-8?q?=20not=20the=20sentence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plain-text/adf-to-plain-text.test.ts | 4 +++- src/plain-text/adf-to-plain-text.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plain-text/adf-to-plain-text.test.ts b/src/plain-text/adf-to-plain-text.test.ts index bd62762..da752d9 100644 --- a/src/plain-text/adf-to-plain-text.test.ts +++ b/src/plain-text/adf-to-plain-text.test.ts @@ -402,7 +402,9 @@ const refusedDocuments: Record = { } 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)) { diff --git a/src/plain-text/adf-to-plain-text.ts b/src/plain-text/adf-to-plain-text.ts index 393d205..360f463 100644 --- a/src/plain-text/adf-to-plain-text.ts +++ b/src/plain-text/adf-to-plain-text.ts @@ -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.