MCPcopy Index your code
hub / github.com/containerd/containerd / TestLongestCommonPrefix

Function TestLongestCommonPrefix

core/mount/mount_linux_test.go:37–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35)
36
37func TestLongestCommonPrefix(t *testing.T) {
38 tcases := []struct {
39 in []string
40 expected string
41 }{
42 {[]string{}, ""},
43 {[]string{"foo"}, "foo"},
44 {[]string{"foo", "bar"}, ""},
45 {[]string{"foo", "foo"}, "foo"},
46 {[]string{"foo", "foobar"}, "foo"},
47 {[]string{"foo", "", "foobar"}, ""},
48 }
49
50 for i, tc := range tcases {
51 if got := longestCommonPrefix(tc.in); got != tc.expected {
52 t.Fatalf("[%d case] expected (%s), but got (%s)", i+1, tc.expected, got)
53 }
54 }
55}
56
57func TestCompactLowerdirOption(t *testing.T) {
58 tcases := []struct {

Callers

nothing calls this directly

Calls 1

longestCommonPrefixFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…