Skip to content

Add test cases for quote pairing and footnote label normalization - #147

Merged
jgm merged 1 commit into
jgm:mainfrom
karlb:test-quote-pairing-and-footnote-labels
Aug 16, 2026
Merged

jgm merged 1 commit into
jgm:mainfrom
karlb:test-quote-pairing-and-footnote-labels

Conversation

@karlb

@karlb karlb commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

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 ".

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.
@jgm
jgm merged commit b45c81d into jgm:main Aug 16, 2026
1 check passed
@jgm

jgm commented Aug 16, 2026

Copy link
Copy Markdown
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants