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

Function TestCommonPrefixLength

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

Source from the content-addressed store, hash-verified

93}
94
95func TestCommonPrefixLength(t *testing.T) {
96 type TestCase struct {
97 Text1 string
98 Text2 string
99
100 Expected int
101 }
102
103 for i, tc := range []TestCase{
104 {"abc", "xyz", 0},
105 {"1234abcdef", "1234xyz", 4},
106 {"1234", "1234xyz", 4},
107 } {
108 actual := commonPrefixLength([]rune(tc.Text1), []rune(tc.Text2))
109 assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %#v", i, tc))
110 }
111}
112
113func TestDiffCommonSuffix(t *testing.T) {
114 type TestCase struct {

Callers

nothing calls this directly

Calls 1

commonPrefixLengthFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…