From 3a5af8cd4a4185f8f185ba7942b4e42ed6360570 Mon Sep 17 00:00:00 2001 From: "carpentry-heartbeat[bot]" Date: Sat, 11 Jul 2026 01:26:42 +0200 Subject: [PATCH] Collapse verbose expected-string constructions in diff tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tests/diff.carp | 110 ++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/tests/diff.carp b/tests/diff.carp index 8f42bc2..531737f 100644 --- a/tests/diff.carp +++ b/tests/diff.carp @@ -169,12 +169,12 @@ lines")) "line-diff of identical strings is all equal") &(Diff.eq &(char-diff "hello" "hello")) "char-diff of identical strings is all equal") - (assert-equal test &(String.concat &[@"@@ -1,3 +1,3 @@ -" @" line1 -" @"+changed -" @"-line2 -" @" line3 -"]) &(unified &(line-diff "line1 + (assert-equal test "@@ -1,3 +1,3 @@ + line1 ++changed +-line2 + line3 +" &(unified &(line-diff "line1 line2 line3" "line1 changed @@ -182,46 +182,46 @@ line3")) "unified renders single-hunk diff with correct header") (assert-equal test "" &(unified &(line-diff "same text" "same text")) "unified of identical strings is empty") - (assert-equal test &(String.concat &[@"@@ -1,4 +1,4 @@ -" @"+new -" @"-old -" @" a -" @" b -" @" c -"]) &(unified &(line-diff "old + (assert-equal test "@@ -1,4 +1,4 @@ ++new +-old + a + b + c +" &(unified &(line-diff "old a b c" "new a b c")) "unified handles change at start") - (assert-equal test &(String.concat &[@"@@ -1,4 +1,4 @@ -" @" a -" @" b -" @" c -" @"+new -" @"-old -"]) &(unified &(line-diff "a + (assert-equal test "@@ -1,4 +1,4 @@ + a + b + c ++new +-old +" &(unified &(line-diff "a b c old" "a b c new")) "unified handles change at end") - (assert-equal test &(String.concat &[@"@@ -1,5 +1,5 @@ -" @" a -" @"+BB -" @"-b -" @" c -" @" d -" @" e -" @"@@ -8,4 +8,4 @@ -" @" h -" @" i -" @" j -" @"+KK -" @"-k -"]) &(unified &(line-diff "a + (assert-equal test "@@ -1,5 +1,5 @@ + a ++BB +-b + c + d + e +@@ -8,4 +8,4 @@ + h + i + j ++KK +-k +" &(unified &(line-diff "a b c d @@ -329,20 +329,20 @@ KK")) "unified generates multiple hunks for distant changes") "str of Insertion with multiple elements") ; unified-with-context - (assert-equal test &(String.concat &[@"@@ -2,1 +2,1 @@ -" @"+changed -" @"-line2 -"]) &(unified-with-context &(line-diff "line1 + (assert-equal test "@@ -2,1 +2,1 @@ ++changed +-line2 +" &(unified-with-context &(line-diff "line1 line2 line3" "line1 changed line3") 0) "unified-with-context 0 omits context lines") - (assert-equal test &(String.concat &[@"@@ -1,3 +1,3 @@ -" @" line1 -" @"+changed -" @"-line2 -" @" line3 -"]) &(unified-with-context &(line-diff "line1 + (assert-equal test "@@ -1,3 +1,3 @@ + line1 ++changed +-line2 + line3 +" &(unified-with-context &(line-diff "line1 line2 line3" "line1 changed @@ -356,17 +356,17 @@ line2 line3" "line1 changed line3") 3) "unified-with-context 3 is identical to unified") - (assert-equal test &(String.concat &[@"@@ -1,3 +1,3 @@ -" @" a -" @"+BB -" @"-b -" @" c -" @"@@ -5,3 +5,3 @@ -" @" e -" @"+FF -" @"-f -" @" g -"]) &(unified-with-context &(line-diff "a + (assert-equal test "@@ -1,3 +1,3 @@ + a ++BB +-b + c +@@ -5,3 +5,3 @@ + e ++FF +-f + g +" &(unified-with-context &(line-diff "a b c d