Add test cases for quote pairing and footnote label normalization - #147
Merged
Merged
Conversation
Two edge cases found while checking cdjot against djot.js. Both pass on main; they pin behaviour that is currently only covered on one side. smart.test has `''hi''` for doubled quotes as nested, but nothing for a doubled quote with an empty span. Adjacent delimiters enclose nothing, so they don't pair and each falls back to its unmatched form -- a right quote for `'`, a left one for `"`. footnotes.test covers label normalization on the reference side (a label spanning lines). The definition side normalizes too, so a wider gap there still matches the reference; that half was untested.
Owner
|
thanks! |
karlb
added a commit
to karlb/cdjot
that referenced
this pull request
Sep 3, 2026
Three only became duplicates when jgm/djot.js#147 landed, so the sync and the removal have to be one commit: the footnote label normalization case and the `""` / `''` pair are now in upstream's footnotes.test and smart.test byte-for-byte. Syncing first would leave them asserted twice; removing first would drop them outright. The other five were already redundant: - `[a](b){rel="me"}` hits the same dolink site as the `{rel=me}` case with no distinguishing branch. "me" holds no `}` or `\`, so the quote-aware brace scan lands on the same terminator; replacing that scan with a bare ae++ is killed by nothing in the suite. The five quoted-value mutants of parse_attrs are all killed by upstream attributes.test. - The URL-less refdef duplicates links_and_images.test:62, which asserts the same empty href on the same construct. The memcpy half of the prose does not save it: d80be5b^ under UBSan is silent on both inputs, so there is no fault left for the local copy to reach. - `x"y` is subsumed by `a"b"c"d`. Its quote and the pair case's third quote enter the same else branch at cdjot.c:3131 in the same state -- dq_open NULL, non-ws after -- and that branch reads only `after`, while the `if` short-circuits on dq_open before touching `before`. No mutation of the block can kill one without the other. This is not the argument 9ac2c11 made and 4b647be reverted; that one claimed upstream coverage, which is still false. 1028f9e^ confirms the difference: it fails the retained case. - `{{{{{{{{{{` duplicates the `{1 {1` case, and the doparagraph rationale it names is not observable at all -- a paragraph of bare braces leaves transformed=0, so the buffer the no_close_after cache fills is discarded before output. A mutant of that skip passes the whole suite. - The whitespace run duplicates para.test:1 and smart.test:135. Both are mid-line runs that take the same b[-1]-is-ws skip; length 2 versus 50 is not a distinction the code makes. x"y's explanation of the smart.test word-boundary trap is the reason it existed, so fold it into the pairing case rather than lose it. Its :199 reference becomes :214, which is where #147's 15 inserted lines put it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
footnotes.test covers label normalization on the reference side (a label spanning lines). The definition side normalizes too, so a wider gap there still matches the reference; that half was untested.
smart.test has
''hi''for doubled quotes as nested, but nothing for a doubled quote with an empty span. Adjacent delimiters enclose nothing, so they don't pair and each falls back to its unmatched form: a right quote for', a left one for".