Skip to content

test: cover the last reachable branches in analyze - #13

Merged
chrisdengso merged 2 commits into
mainfrom
test/branch-coverage-gaps
Jul 19, 2026
Merged

test: cover the last reachable branches in analyze#13
chrisdengso merged 2 commits into
mainfrom
test/branch-coverage-gaps

Conversation

@chrisdengso

Copy link
Copy Markdown
Contributor

analyze.ts was at 98.52% branch coverage with three uncovered branches. Two were genuine test gaps; the third is unreachable by construction.

Tests added

  • Unicode non-characters — the BMP block U+FDD0–U+FDEF was never exercised, though its sibling U+xxFFFE/U+xxFFFF check was. Now covers all three via one case.
  • Whole-token ASCII guard on the styled-confusable rule — the false path was untested. It is reachable: a token can hold ≥2 letters that individually fold to ASCII while the token itself does not (styled pr followed by é folds to pré), and that must not be flagged as a disguised word.
  • Enclosed digit runs①②③ was described in a comment but never asserted.

Comment fix

The styled-run block comment credited the flush guard with excluding digit runs. Digits are actually excluded one step earlier, at run accumulation — a styled digit fails the letter test and never joins a run at all. Moved the note there and marked the flush guard as the redundant check it is.

Coverage

analyze.ts: 100% statements / 99.5% branches / 100% lines (was 99.56 / 98.52 / 100).

The one remaining branch is the flush guard above. Every character in a run has already passed the same two tests individually, so the concatenation cannot fail them — no test can cover it. Left in place as defense-in-depth rather than deleted; the comment now says so.

No behavior change, so no changeset. 265 tests pass, typecheck and lint clean.

🤖 Generated with Claude Code

chrisdengso and others added 2 commits July 20, 2026 00:41
Three branch gaps, now closed:

- The BMP non-character block U+FDD0-U+FDEF was never exercised, though
  its sibling U+xxFFFE/FFFF check was.
- The whole-token ASCII guard on the styled-confusable rule never took
  its false path: a token can have >=2 letters that individually fold to
  ASCII while the token itself does not (styled "pr" + an accented e).
- Runs of enclosed digits were documented but untested.

analyze.ts branch coverage 98.52% -> 99.5%. The one remaining branch is
unreachable by construction: characters only enter a styled run if they
already pass the same two tests the flush guard re-applies. Left in
place as defense-in-depth rather than deleted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The styled-run block comment credited the flush guard with excluding
digit runs, but digits are excluded earlier — they never join a run,
because a styled digit fails the letter test at the accumulation step.
Move the note there and mark the flush guard as the redundant check it
is, so the next reader does not go hunting for a test that can cover it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chrisdengso
chrisdengso merged commit 7498c16 into main Jul 19, 2026
1 check passed
@chrisdengso
chrisdengso deleted the test/branch-coverage-gaps branch July 19, 2026 22:45
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.

1 participant