Skip to content

Commit 082fb5f

Browse files
committed
Test case to confirm that a timeout of 0 does not alter the patch
outcome Closes sergi#28
1 parent 159219e commit 082fb5f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

diffmatchpatch/dmp_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,14 @@ func Test_patch_make(t *testing.T) {
12591259

12601260
patches = dmp.PatchMake("2016-09-01T03:07:14.807830741Z", "2016-09-01T03:07:15.154800781Z")
12611261
assert.Equal(t, "@@ -15,16 +15,16 @@\n 07:1\n+5.15\n 4\n-.\n 80\n+0\n 78\n-3074\n 1Z\n", dmp.PatchToText(patches), "patch_make: Corner case of #31 fixed by #32")
1262+
1263+
text1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ut risus et enim consectetur convallis a non ipsum. Sed nec nibh cursus, interdum libero vel."
1264+
text2 = "Lorem a ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ut risus et enim consectetur convallis a non ipsum. Sed nec nibh cursus, interdum liberovel."
1265+
dmp2 := New()
1266+
dmp2.DiffTimeout = 0
1267+
diffs = dmp2.DiffMain(text1, text2, true)
1268+
patches = dmp2.PatchMake(text1, diffs)
1269+
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")
12621270
}
12631271

12641272
func Test_PatchSplitMax(t *testing.T) {

0 commit comments

Comments
 (0)