Skip to content

Commit fb91e0d

Browse files
committed
Make the DiffCharsToLines text match the python version more closely.
1 parent 3d62d8d commit fb91e0d

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

diffmatchpatch/dmp_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,25 +257,22 @@ func Test_diffCharsToLines(t *testing.T) {
257257
Diff{DiffInsert, "beta\nalpha\nbeta\n"}}, actual)
258258

259259
// More than 256 to reveal any 8-bit limitations.
260-
n := 257
261-
tmpVector = []string{}
262-
lineList := []rune{}
260+
n := 300
261+
lineList := []string{}
263262
charList := []rune{}
264263

265264
for x := 1; x <= n; x++ {
266-
tmpVector = append(tmpVector, string(x)+"\n")
267-
lineList = append(lineList, rune(x), '\n')
265+
lineList = append(lineList, strconv.Itoa(x) + "\n")
268266
charList = append(charList, rune(x))
269267
}
270268

271-
assert.Equal(t, n, len(tmpVector))
272269
assert.Equal(t, n, len(charList))
273270

274-
tmpVector = append([]string{""}, tmpVector...)
271+
lineList = append([]string{""}, lineList...)
275272
diffs = []Diff{Diff{DiffDelete, string(charList)}}
276-
actual = dmp.DiffCharsToLines(diffs, tmpVector)
273+
actual = dmp.DiffCharsToLines(diffs, lineList)
277274
assertDiffEqual(t, []Diff{
278-
Diff{DiffDelete, string(lineList)}}, actual)
275+
Diff{DiffDelete, strings.Join(lineList, "")}}, actual)
279276
}
280277

281278
func Test_diffCleanupMerge(t *testing.T) {

0 commit comments

Comments
 (0)