@@ -116,7 +116,7 @@ func diffRebuildtexts(diffs []Diff) []string {
116
116
}
117
117
118
118
func Test_diffCommonPrefix (t * testing.T ) {
119
- dmp := createDMP ()
119
+ dmp := New ()
120
120
// Detect any common suffix.
121
121
// Null case.
122
122
assert .Equal (t , 0 , dmp .DiffCommonPrefix ("abc" , "xyz" ), "'abc' and 'xyz' should not be equal" )
@@ -129,7 +129,7 @@ func Test_diffCommonPrefix(t *testing.T) {
129
129
}
130
130
131
131
func Test_diffCommonSuffixTest (t * testing.T ) {
132
- dmp := createDMP ()
132
+ dmp := New ()
133
133
// Detect any common suffix.
134
134
// Null case.
135
135
assert .Equal (t , 0 , dmp .DiffCommonSuffix ("abc" , "xyz" ), "" )
@@ -142,7 +142,7 @@ func Test_diffCommonSuffixTest(t *testing.T) {
142
142
}
143
143
144
144
func Test_diffCommonOverlapTest (t * testing.T ) {
145
- dmp := createDMP ()
145
+ dmp := New ()
146
146
// Detect any suffix/prefix overlap.
147
147
// Null case.
148
148
assert .Equal (t , 0 , dmp .DiffCommonOverlap ("" , "abcd" ), "" )
@@ -163,7 +163,7 @@ func Test_diffCommonOverlapTest(t *testing.T) {
163
163
}
164
164
165
165
func Test_diffHalfmatchTest (t * testing.T ) {
166
- dmp := createDMP ()
166
+ dmp := New ()
167
167
dmp .DiffTimeout = 1
168
168
// No match.
169
169
softAssert (t , dmp .DiffHalfMatch ("1234567890" , "abcdef" ) == nil , "" )
@@ -197,7 +197,7 @@ func Test_diffHalfmatchTest(t *testing.T) {
197
197
}
198
198
199
199
func Test_diffLinesToChars (t * testing.T ) {
200
- dmp := createDMP ()
200
+ dmp := New ()
201
201
// Convert lines down to characters.
202
202
tmpVector := []string {"" , "alpha\n " , "beta\n " }
203
203
@@ -246,7 +246,7 @@ func Test_diffLinesToChars(t *testing.T) {
246
246
}
247
247
248
248
func Test_diffCharsToLines (t * testing.T ) {
249
- dmp := createDMP ()
249
+ dmp := New ()
250
250
// Convert chars up to lines.
251
251
diffs := []Diff {
252
252
Diff {DiffEqual , "\u0001 \u0002 \u0001 " },
@@ -281,7 +281,7 @@ func Test_diffCharsToLines(t *testing.T) {
281
281
}
282
282
283
283
func Test_diffCleanupMerge (t * testing.T ) {
284
- dmp := createDMP ()
284
+ dmp := New ()
285
285
// Cleanup a messy diff.
286
286
// Null case.
287
287
diffs := []Diff {}
@@ -346,7 +346,7 @@ func Test_diffCleanupMerge(t *testing.T) {
346
346
}
347
347
348
348
func Test_diffCleanupSemanticLossless (t * testing.T ) {
349
- dmp := createDMP ()
349
+ dmp := New ()
350
350
// Slide diffs to match logical boundaries.
351
351
// Null case.
352
352
diffs := []Diff {}
@@ -445,7 +445,7 @@ func Test_diffCleanupSemanticLossless(t *testing.T) {
445
445
}
446
446
447
447
func Test_diffCleanupSemantic (t * testing.T ) {
448
- dmp := createDMP ()
448
+ dmp := New ()
449
449
// Cleanup semantically trivial equalities.
450
450
// Null case.
451
451
diffs := []Diff {}
@@ -575,7 +575,7 @@ func Test_diffCleanupSemantic(t *testing.T) {
575
575
}
576
576
577
577
func Test_diffCleanupEfficiency (t * testing.T ) {
578
- dmp := createDMP ()
578
+ dmp := New ()
579
579
// Cleanup operationally trivial equalities.
580
580
dmp .DiffEditCost = 4
581
581
// Null case.
@@ -652,7 +652,7 @@ func Test_diffCleanupEfficiency(t *testing.T) {
652
652
653
653
/*
654
654
func Test_diffPrettyHtml(t *testing.T) {
655
- dmp := createDMP ()
655
+ dmp := New ()
656
656
// Pretty print.
657
657
diffs := []Diff{
658
658
Diff{DiffEqual, "a\n"},
@@ -663,7 +663,7 @@ func Test_diffPrettyHtml(t *testing.T) {
663
663
}*/
664
664
665
665
func Test_diffText (t * testing.T ) {
666
- dmp := createDMP ()
666
+ dmp := New ()
667
667
// Compute the source and destination texts.
668
668
diffs := []Diff {
669
669
Diff {DiffEqual , "jump" },
@@ -678,7 +678,7 @@ func Test_diffText(t *testing.T) {
678
678
}
679
679
680
680
func Test_diffDelta (t * testing.T ) {
681
- dmp := createDMP ()
681
+ dmp := New ()
682
682
// Convert a diff into delta string.
683
683
diffs := []Diff {
684
684
Diff {DiffEqual , "jump" },
@@ -753,7 +753,7 @@ func Test_diffDelta(t *testing.T) {
753
753
}
754
754
755
755
func Test_diffXIndex (t * testing.T ) {
756
- dmp := createDMP ()
756
+ dmp := New ()
757
757
// Translate a location in text1 to text2.
758
758
diffs := []Diff {
759
759
Diff {DiffDelete , "a" },
@@ -769,7 +769,7 @@ func Test_diffXIndex(t *testing.T) {
769
769
}
770
770
771
771
func Test_diffLevenshtein (t * testing.T ) {
772
- dmp := createDMP ()
772
+ dmp := New ()
773
773
diffs := []Diff {
774
774
Diff {DiffDelete , "abc" },
775
775
Diff {DiffInsert , "1234" },
@@ -790,7 +790,7 @@ func Test_diffLevenshtein(t *testing.T) {
790
790
}
791
791
792
792
func Test_diffBisect (t * testing.T ) {
793
- dmp := createDMP ()
793
+ dmp := New ()
794
794
// Normal.
795
795
a := "cat"
796
796
b := "map"
@@ -812,7 +812,7 @@ func Test_diffBisect(t *testing.T) {
812
812
}
813
813
814
814
func Test_diffMain (t * testing.T ) {
815
- dmp := createDMP ()
815
+ dmp := New ()
816
816
// Perform a trivial diff.
817
817
diffs := []Diff {}
818
818
assertDiffEqual (t , diffs , dmp .DiffMain ("" , "" , false ))
@@ -908,7 +908,7 @@ func Test_diffMain(t *testing.T) {
908
908
}
909
909
910
910
func Test_match_alphabet (t * testing.T ) {
911
- dmp := createDMP ()
911
+ dmp := New ()
912
912
// Initialise the bitmasks for Bitap.
913
913
bitmask := map [byte ]int {
914
914
'a' : 4 ,
@@ -926,7 +926,7 @@ func Test_match_alphabet(t *testing.T) {
926
926
}
927
927
928
928
func Test_match_bitap (t * testing.T ) {
929
- dmp := createDMP ()
929
+ dmp := New ()
930
930
931
931
// Bitap algorithm.
932
932
dmp .MatchDistance = 100
@@ -973,7 +973,7 @@ func Test_match_bitap(t *testing.T) {
973
973
}
974
974
975
975
func Test_MatchMain (t * testing.T ) {
976
- dmp := createDMP ()
976
+ dmp := New ()
977
977
// Full match.
978
978
assert .Equal (t , 0 , dmp .MatchMain ("abcdef" , "abcdef" , 1000 ), "MatchMain: Equality." )
979
979
@@ -1015,7 +1015,7 @@ func Test_patch_patchObj(t *testing.T) {
1015
1015
}
1016
1016
1017
1017
func Test_patch_fromText (t * testing.T ) {
1018
- dmp := createDMP ()
1018
+ dmp := New ()
1019
1019
1020
1020
_v1 , _ := dmp .PatchFromText ("" )
1021
1021
softAssert (t , len (_v1 ) == 0 , "patch_fromText: #0." )
@@ -1038,7 +1038,7 @@ func Test_patch_fromText(t *testing.T) {
1038
1038
}
1039
1039
1040
1040
func Test_patch_toText (t * testing.T ) {
1041
- dmp := createDMP ()
1041
+ dmp := New ()
1042
1042
strp := "@@ -21,18 +22,17 @@\n jump\n -s\n +ed\n over \n -the\n +a\n laz\n "
1043
1043
var patches []Patch
1044
1044
patches , _ = dmp .PatchFromText (strp )
@@ -1052,7 +1052,7 @@ func Test_patch_toText(t *testing.T) {
1052
1052
}
1053
1053
1054
1054
func Test_patch_addContext (t * testing.T ) {
1055
- dmp := createDMP ()
1055
+ dmp := New ()
1056
1056
dmp .PatchMargin = 4
1057
1057
var p Patch
1058
1058
_p , _ := dmp .PatchFromText ("@@ -21,4 +21,10 @@\n -jump\n +somersault\n " )
@@ -1077,7 +1077,7 @@ func Test_patch_addContext(t *testing.T) {
1077
1077
}
1078
1078
1079
1079
func Test_patch_make (t * testing.T ) {
1080
- dmp := createDMP ()
1080
+ dmp := New ()
1081
1081
var patches []Patch
1082
1082
patches = dmp .PatchMake ("" , "" )
1083
1083
assert .Equal (t , "" , dmp .PatchToText (patches ), "patch_make: Null case." )
@@ -1131,7 +1131,7 @@ func Test_patch_make(t *testing.T) {
1131
1131
1132
1132
func Test_PatchSplitMax (t * testing.T ) {
1133
1133
// Assumes that Match_MaxBits is 32.
1134
- dmp := createDMP ()
1134
+ dmp := New ()
1135
1135
var patches []Patch
1136
1136
1137
1137
patches = dmp .PatchMake ("abcdefghijklmnopqrstuvwxyz01234567890" , "XabXcdXefXghXijXklXmnXopXqrXstXuvXwxXyzX01X23X45X67X89X0" )
@@ -1153,7 +1153,7 @@ func Test_PatchSplitMax(t *testing.T) {
1153
1153
}
1154
1154
1155
1155
func Test_PatchAddPadding (t * testing.T ) {
1156
- dmp := createDMP ()
1156
+ dmp := New ()
1157
1157
var patches []Patch
1158
1158
patches = dmp .PatchMake ("" , "test" )
1159
1159
assert .Equal (t , "@@ -0,0 +1,4 @@\n +test\n " ,
@@ -1184,7 +1184,7 @@ func Test_PatchAddPadding(t *testing.T) {
1184
1184
}
1185
1185
1186
1186
func Test_patchApply (t * testing.T ) {
1187
- dmp := createDMP ()
1187
+ dmp := New ()
1188
1188
dmp .MatchDistance = 1000
1189
1189
dmp .MatchThreshold = 0.5
1190
1190
dmp .PatchDeleteThreshold = 0.5
0 commit comments