Skip to content

Commit e7fd693

Browse files
committed
Wrote breaking test for BisectSplit_.
1 parent 80def51 commit e7fd693

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

diffmatchpatch/dmp_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,17 @@ func Test_diffHalfmatchTest(t *testing.T) {
193193
assert.True(t, dmp.DiffHalfMatch("qHilloHelloHew", "xHelloHeHulloy") == nil, "")
194194
}
195195

196+
func Test_diffBisectSplit(t *testing.T) {
197+
// As originally written, this can produce invalid utf8 strings.
198+
dmp := New()
199+
diffs := dmp.diffBisectSplit_("STUV\x05WX\x05YZ\x05[",
200+
"WĺĻļ\x05YZ\x05ĽľĿŀZ", 7, 6, time.Now().Add(time.Hour))
201+
for _, d := range diffs {
202+
assert.True(t, utf8.ValidString(d.Text))
203+
}
204+
}
205+
206+
196207
func Test_diffLinesToChars(t *testing.T) {
197208
dmp := New()
198209
// Convert lines down to characters.

0 commit comments

Comments
 (0)