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

Function TestCommonSuffixLength

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

Source from the content-addressed store, hash-verified

179}
180
181func TestCommonSuffixLength(t *testing.T) {
182 type TestCase struct {
183 Text1 string
184 Text2 string
185
186 Expected int
187 }
188
189 for i, tc := range []TestCase{
190 {"abc", "xyz", 0},
191 {"abcdef1234", "xyz1234", 4},
192 {"1234", "xyz1234", 4},
193 {"123", "a3", 1},
194 } {
195 actual := commonSuffixLength([]rune(tc.Text1), []rune(tc.Text2))
196 assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %#v", i, tc))
197 }
198}
199
200func TestDiffCommonOverlap(t *testing.T) {
201 type TestCase struct {

Callers

nothing calls this directly

Calls 1

commonSuffixLengthFunction · 0.85

Tested by

no test coverage detected