oxedyne/fe2o3/fe2o3_austenite/tests/oracle/fixtures/context_comment_fixture.typ
2.3 KiB, 1 run
created by r1870400018:58223, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | // The comment-aware skip-scanner regression root (G3). `context_fixture.typ` already gates the reader |
| 2 | // refusing a `#context { ... }` block outright; this one gates a narrower failure in how far that block's |
| 3 | // skip reaches when a comment inside it mentions a brace. Before the fix, `//` and `/* ... */` were not |
| 4 | // recognised inside the multi-line bracket/brace skip scanner ([`SkipState`]), so a `}` written inside a |
| 5 | // comment -- `let c = 1 // }` -- popped the block's own brace early: the skip closed after the comment |
| 6 | // line, and the block's real tail (its remaining statements and its own closing `}`) leaked into the body |
| 7 | // as raw source. Deliberately self-contained, like `context_fixture.typ`, so it needs no symbol-modifier |
| 8 | // patch to compile under typst 0.15.1. |
| 9 | // |
| 10 | // The block below binds locals and emits nothing, so Typst evaluates it to no content and Austenite |
| 11 | // refuses-and-drops it whole: the two engines' pages agree. A regression that re-leaked the block's tail |
| 12 | // past the commented brace would set its remaining source lines as extra paragraphs, moving the pinned |
| 13 | // PDF hash and the heading pages the oracle order-matches against Typst. |
| 14 | #let doc(body, heading-font: "Libertinus Serif") = body |
| 15 | #show: doc.with(heading-font: "Libertinus Serif") |
| 16 | |
| 17 | = A Commented Context Leak Fixture |
| 18 | |
| 19 | This paragraph precedes the context block, and is written long enough to wrap onto more than one line so |
| 20 | the page carries real body text the raster sample can land on rather than a single short line where a |
| 21 | regression might hide. |
| 22 | |
| 23 | #context { |
| 24 | let c = 1 // a line comment mentioning a brace: c = 1 } |
| 25 | /* a block comment mentioning a brace: } */ |
| 26 | let claim-refs = ("c1", "c2", "c3", "c4") |
| 27 | let by-code = (:) |
| 28 | for r in claim-refs { |
| 29 | if r in by-code { |
| 30 | by-code.insert(r, by-code.at(r) + 1) |
| 31 | } else { |
| 32 | by-code.insert(r, 1) |
| 33 | } |
| 34 | } |
| 35 | let codes = by-code.keys().sorted() |
| 36 | let total = codes.len() |
| 37 | } |
| 38 | |
| 39 | This paragraph follows the context block. Both engines set exactly these two paragraphs and nothing |
| 40 | between them: Austenite refuses and drops the block whole, comments included, and Typst evaluates it to no |
| 41 | content, so the body is identical either way. |
| 42 | |
| 43 | == A Second Heading |
| 44 | |
| 45 | A second short section, so the fixture carries more than one heading for the oracle's order-matched |
| 46 | anchor-page comparison to line up against. |