test: cover the last reachable branches in analyze - #13
Merged
Conversation
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>
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.
analyze.tswas at 98.52% branch coverage with three uncovered branches. Two were genuine test gaps; the third is unreachable by construction.Tests added
U+FDD0–U+FDEFwas never exercised, though its siblingU+xxFFFE/U+xxFFFFcheck was. Now covers all three via one case.prfollowed byéfolds topré), and that must not be flagged as a disguised word.①②③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