Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 55 additions & 55 deletions tests/diff.carp
Original file line number Diff line number Diff line change
Expand Up @@ -169,59 +169,59 @@ 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
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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading