From cf6d27e158efc742ae6629ee84adb27960b9cead Mon Sep 17 00:00:00 2001 From: Markus Zimmermann Date: Mon, 31 Oct 2016 20:36:54 +0100 Subject: [PATCH] Test case to make sure that diff texts are equal to originals with checklines=true Closes #29 --- diffmatchpatch/dmp_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/diffmatchpatch/dmp_test.go b/diffmatchpatch/dmp_test.go index bbfeae9..7ee4da4 100644 --- a/diffmatchpatch/dmp_test.go +++ b/diffmatchpatch/dmp_test.go @@ -1270,6 +1270,10 @@ func Test_patch_make(t *testing.T) { diffs = dmp2.DiffMain(text1, text2, true) patches = dmp2.PatchMake(text1, diffs) assert.Equal(t, "@@ -1,14 +1,16 @@\n Lorem \n+a \n ipsum do\n@@ -148,13 +148,12 @@\n m libero\n- \n vel.\n", dmp2.PatchToText(patches), "patch_make: Corner case of #28 wrong patch with timeout of 0") + + // Additional check that the diff texts are equal to the originals even if we are using DiffMain with checklines=true #29 + assert.Equal(t, text1, dmp2.DiffText1(diffs)) + assert.Equal(t, text2, dmp2.DiffText2(diffs)) } func Test_PatchSplitMax(t *testing.T) {