Text Diff Modes: A 14-Pair Comparison Test
Fourteen Text Diff fixture pairs covering exact, case, whitespace, blank lines, edits, Unicode, word mode, and newline normalization.
- Question
- Which live Text Diff ignore/compare options turn a visible edit into a match, and which differences always remain?
- Samples
- 14 fixtures
- Generated via core
- 14
- Manual / limits
- 0
- Published
- Modified
- Author
- Dionis Ceban
- Method
- Fourteen pairs call generateTextDiffWithStats with the same option flags exposed on Text Diff: compare lines/words, ignore case, ignore whitespace, ignore blank lines. expectMatch asserts whether totalDifferences is zero.
Why this test matters
Reviewers flip ignore toggles to reduce noise. Documenting when a match is option-dependent prevents accidental approvals.
Tools under test
Live comparison modes tested
- Compare lines
- Compare words
- Ignore case
- Ignore whitespace
- Ignore blank lines
- Show unchanged lines
- Highlight changes inline
- Side-by-side view
- Unified view
Result summary
14 of 14 fixtures were executed through assets/js/tools-src/core.js. 0 entries are labeled manual review or limitation without inventing a transform result.
Full test matrix (14 samples)
| ID | Case | Input | Operation | Observed | Status |
|---|---|---|---|---|---|
| diff-exact-01 | Exact match | Hello world β Hello world |
lines | Match (similarity 100%) | Pass |
| diff-case-02 | Case-only (sensitive) | Hello β hello |
lines | Differs (+0/β0/~1) | Pass |
| diff-case-ignore-03 | Case-only (ignore case) | Hello β hello |
lines, ignore case | Match (similarity 100%) | Pass |
| diff-ws-04 | Whitespace-only (exact) | Hello world β Hello world |
lines | Differs (+0/β0/~1) | Pass |
| diff-ws-ignore-05 | Whitespace-only (ignore) | Hello world β Hello world |
lines, ignore whitespace | Match (similarity 100%) | Pass |
| diff-insert-06 | Inserted line | A
B β A
B
C |
lines | Differs (+1/β0/~0) | Pass |
| diff-delete-07 | Deleted line | A
B
C β A
C |
lines | Differs (+0/β1/~0) | Pass |
| diff-reorder-08 | Reordered lines | A
B
C β A
C
B |
lines | Differs (+1/β1/~0) | Pass |
| diff-punct-09 | Punctuation change | Hello, world β Hello world |
lines | Differs (+0/β0/~1) | Pass |
| diff-unicode-10 | Unicode composed vs combining | Γ© β eΜ |
lines | Differs (+0/β0/~1) | Pass |
| diff-blank-11 | Blank lines ignored | A
B β A
B |
lines, ignore blank lines | Match (similarity 100%) | Pass |
| diff-long-12 | Long line change | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx β xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy |
lines | Differs (+0/β0/~1) | Pass |
| diff-words-13 | Word mode change | The fox jumps β The fox leaps |
words | Differs (+1/β1/~0) | Pass |
| diff-newlines-14 | CRLF vs LF after line split | a
b β a
b |
lines | Match (similarity 100%) | Pass |
Edge cases and failures
NFC Γ© vs combining e+ Μ is a real difference under exact compare. CRLF vs LF is normalized during line splitting, so default compare treats them as matching breaks.
Conclusion
Start exact; enable ignore options only when you intend to hide that class of change. Mode choice is part of the review record.
Limitations
- Does not implement external diff utilities (git, Myers variants beyond this LCS implementation).
- Display-only options (side-by-side vs unified, inline highlight) are not asserted in these fixtures.
- Unicode normalization is not applied before compare.
Reproducibility
Open Text Diff, set the options named in each fixture, paste the pair, and confirm match/mismatch against expected-results.jsonβor re-run npm run guides:evidence.
Downloadable evidence
- Fixture corpus (JSON) (3.6 KB)
- Observed results (JSON) (5.3 KB)
- diff-pairs.csv (1.4 KB)