Clean up and reorganize diff tests (#11)#12
Conversation
There was a problem hiding this comment.
Build & Tests
Checked out claude/cleanup-diff-tests at c258d27 and ran it locally.
- Build: clean.
- Tests:
carp -x tests/diff.carp→ 72 passed, 0 failed. I also ran the suite onmasterfor comparison → 72 passed, 0 failed. Identical. - carp-fmt
--checkand angler: clean. - CI: both
testjobs green.
Findings
This is a test-only reorganization, and the one thing that matters for a "cleanup" PR is that it doesn't quietly weaken coverage. The PR claims the expected/actual expressions are preserved verbatim and only ordering, grouping, section comments, and message wording changed. I verified that claim independently rather than taking it on trust: I parsed both master and the branch versions of tests/diff.carp with an S-expression parser (handling Carp char literals and comments), stripped the test argument and the trailing message string from every assert-equal, and compared the multiset of (expected, actual) content pairs across all 72 assertions.
Result: the two multisets are identical — 72 forms on each side, same distinct content, zero pairs present on one side but not the other. So no assertion was dropped, added, reordered-into-oblivion, or had its expected value or tested expression altered. The only changes are:
- Section comments grouping the asserts by feature (
core diff, empty/single-element, word/line/char diffs, apply, revert, lcs-length, edit-distance, similarity, str/prn, unified & unified-with-context, patch) — a sensible organization that matches the file's actual contents. - Reordering related asserts together (e.g. the prefix/suffix and "completely different" cases now sit with the core diff group).
- Message rewording for consistency and precision (
"diffing equal lists means everything is equal"→"diff of equal arrays is all Eq"; "lists" normalized to "arrays" throughout). The new messages are genuinely clearer.
deftest/with-test threading is intact — the section comments sit between top-level (assert-equal test …) forms, not inside a do, so every assert is still threaded and counted (72 run, matching master). The library source is untouched (only tests/diff.carp changed). No CHANGELOG needed — this is test-internal, not user-facing.
Verdict: merge
This does exactly what issue #11 asked for — a formatting/organization cleanup of the test file — and I mechanically confirmed coverage is preserved verbatim. It builds, all 72 tests pass, formatting and lint are clean, and there are no open questions. Ready to land.
hellerve
left a comment
There was a problem hiding this comment.
this does nothing of what i wanted changed and just churns for no reason.
| h | ||
| i | ||
| j | ||
| KK")) "unified generates multiple hunks for distant changes") |
There was a problem hiding this comment.
this long span of one-char-per-line strings is what i mean.
The unified/patch assertions built their expected output with &(String.concat &[@"...one line..." @"...next line..." ...]) — a long span of one-char-per-line fragments. Replace each with the equivalent plain multi-line string literal (already a Ref String, so no &). Byte-identical expected values; coverage unchanged (72 passed, 0 failed). Addresses #11.
c258d27 to
3a5af8c
Compare
|
@hellerve — you're right, and I've redone this from scratch. The reordering and message rewording were churn you didn't ask for, so I hard-reset the branch back to Each of the 7 unified / unified-with-context assertions built its expected output like this: and is now just the plain multi-line literal it was spelling out the hard way: The Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet. |
There was a problem hiding this comment.
Build & Tests
Checked out claude/cleanup-diff-tests at 3a5af8c. The branch is now master (63b5e65) + exactly one commit — I confirmed the hard-reset, so none of the earlier reordering/message churn survives.
- Only
tests/diff.carpchanged (55 ins / 55 del, a symmetric 1:1 replacement). Library source untouched. carp -x tests/diff.carp→ 72 passed, 0 failed.carp-fmt --checkandangler: clean. CI: both jobs green.
Prior feedback
- My earlier review (on the previous HEAD
c258d27) recommended merge — that was wrong. It was the version you rejected as churn: it reorganized and reworded instead of fixing the thing you pointed at. - Your inline note was that the "long span of one-char-per-line strings" was the actual problem. This revision addresses exactly that: all 7
&(String.concat &[@"…\n" @"…\n" …])expected values are now plain multi-line string literals.grepconfirms zeroString.concatleft in the file. - No reordering, no message rewording this round — I diffed against
masterand the only changed lines are the expected-string collapses; every assert message and tested expression is byte-for-byte untouched.
Findings
- Byte-identity holds. Since the library source is unchanged and all 72 asserts still pass, each new literal equals the function's real output — the same output the old
String.concatform matched onmaster. So the expected values are byte-identical, just spelled directly (e.g. the concat for "unified renders single-hunk diff" is now the literal"@@ -1,3 +1,3 @@\n line1\n+changed\n-line2\n line3\n"). - A bare
"…"literal is already aRef String, matching the&(unified …)it's compared against — consistent with the existing""empty-diff assertion. No type change. - Nothing else found.
Verdict: merge
Delivers exactly the cleanup issue #11 asked for and you pointed at inline — the one-char-per-line expected strings are gone, replaced by byte-identical plain literals with zero other churn. Builds, 72/72 pass, fmt/lint clean.
|
Stop guessing and blindly flailing please. |
Addresses #11 — the test file was, in @hellerve's words, "a right mess … mostly formatting."
What changed
carp-fmtsettle the layout.Coverage is unchanged
(expected, actual-expression)pairs is identical (messages ignored).Verification
carp -x tests/diff.carp→ Passed: 72, Failed: 0 (both before and after).carp-fmt --check tests/diff.carp→ clean.angler tests/diff.carp→ clean.Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet.