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

Function TestDiffPartialLineIndex

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

Source from the content-addressed store, hash-verified

1508}
1509
1510func TestDiffPartialLineIndex(t *testing.T) {
1511 dmp := New()
1512 t1, t2, tt := dmp.DiffLinesToChars(
1513 `line 1
1514line 2
1515line 3
1516line 4
1517line 5
1518line 6
1519line 7
1520line 8
1521line 9
1522line 10 text1`,
1523 `line 1
1524line 2
1525line 3
1526line 4
1527line 5
1528line 6
1529line 7
1530line 8
1531line 9
1532line 10 text2`)
1533 diffs := dmp.DiffMain(t1, t2, false)
1534 diffs = dmp.DiffCharsToLines(diffs, tt)
1535 assert.Equal(t, []Diff{
1536 Diff{DiffEqual, "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\nline 7\nline 8\nline 9\n"},
1537 Diff{DiffDelete, "line 10 text1"},
1538 Diff{DiffInsert, "line 10 text2"},
1539 }, diffs)
1540}
1541
1542func BenchmarkDiffMain(bench *testing.B) {
1543 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