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

Function TestDiffCommonOverlap

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

Source from the content-addressed store, hash-verified

198}
199
200func TestDiffCommonOverlap(t *testing.T) {
201 type TestCase struct {
202 Name string
203
204 Text1 string
205 Text2 string
206
207 Expected int
208 }
209
210 dmp := New()
211
212 for i, tc := range []TestCase{
213 {"Null", "", "abcd", 0},
214 {"Whole", "abc", "abcd", 3},
215 {"Null", "123456", "abcd", 0},
216 {"Null", "123456xxx", "xxxabcd", 3},
217 // Some overly clever languages (C#) may treat ligatures as equal to their component letters, e.g. U+FB01 == 'fi'
218 {"Unicode", "fi", "\ufb01i", 0},
219 } {
220 actual := dmp.DiffCommonOverlap(tc.Text1, tc.Text2)
221 assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %s", i, tc.Name))
222 }
223}
224
225func TestDiffHalfMatch(t *testing.T) {
226 type TestCase struct {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.85
DiffCommonOverlapMethod · 0.80

Tested by

no test coverage detected