MCPcopy Create free account
hub / github.com/sergi/go-diff / TestDiffPartialLineIndex

Function TestDiffPartialLineIndex

diffmatchpatch/diff_test.go:1482–1512  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1480}
1481
1482func TestDiffPartialLineIndex(t *testing.T) {
1483 dmp := New()
1484 t1, t2, tt := dmp.DiffLinesToChars(
1485 `line 1
1486line 2
1487line 3
1488line 4
1489line 5
1490line 6
1491line 7
1492line 8
1493line 9
1494line 10 text1`,
1495 `line 1
1496line 2
1497line 3
1498line 4
1499line 5
1500line 6
1501line 7
1502line 8
1503line 9
1504line 10 text2`)
1505 diffs := dmp.DiffMain(t1, t2, false)
1506 diffs = dmp.DiffCharsToLines(diffs, tt)
1507 assert.Equal(t, []Diff{
1508 Diff{DiffEqual, "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\nline 7\nline 8\nline 9\n"},
1509 Diff{DiffDelete, "line 10 text1"},
1510 Diff{DiffInsert, "line 10 text2"},
1511 }, diffs)
1512}
1513
1514func BenchmarkDiffMain(bench *testing.B) {
1515 s1 := "`Twas brillig, and the slithy toves\nDid gyre and gimble in the wabe:\nAll mimsy were the borogoves,\nAnd the mome raths outgrabe.\n"

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
DiffLinesToCharsMethod · 0.80
DiffMainMethod · 0.80
DiffCharsToLinesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…