aboutsummaryrefslogtreecommitdiff
path: root/slice/slice_test.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-22 14:37:55 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-22 14:37:55 +0200
commit1b29f83c7f9f8afa4f1ab247513bcacc2507156f (patch)
tree76d7718cd52b979d690c05d713b732f21e6f84ed /slice/slice_test.go
parentca5855639a1a95f04ac2dbd5da5d9d770935cc3c (diff)
downloaddna-backup-1b29f83c7f9f8afa4f1ab247513bcacc2507156f.tar.gz
dna-backup-1b29f83c7f9f8afa4f1ab247513bcacc2507156f.zip
fix slice.Patch with empty delta
Diffstat (limited to 'slice/slice_test.go')
-rw-r--r--slice/slice_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/slice/slice_test.go b/slice/slice_test.go
index f6aecbc..0cf1c40 100644
--- a/slice/slice_test.go
+++ b/slice/slice_test.go
@@ -19,3 +19,13 @@ func TestPatch(t *testing.T) {
actual := Patch(source, patch)
testutils.AssertSame(t, target, actual, "Target obtained from patch application")
}
+
+func TestEmptyPatch(t *testing.T) {
+ source := Slice{1, 2, 3, 4}
+ target := Slice{1, 2, 3, 4}
+ patch := Diff(source, target)
+ testutils.AssertSame(t, *new([]Del), patch.Del, "Patch del part")
+ testutils.AssertSame(t, *new([]Ins), patch.Ins, "Patch ins part")
+ actual := Patch(source, patch)
+ testutils.AssertSame(t, target, actual, "Target obtained from patch application")
+}