MCPcopy
hub / github.com/containerd/containerd / TestCommonPrefixComponents

Function TestCommonPrefixComponents

core/remotes/docker/handler_test.go:79–105  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestCommonPrefixComponents(t *testing.T) {
80 for _, tc := range []struct {
81 components []string
82 target string
83 expected int
84 }{
85 {
86 components: []string{"foo"},
87 target: "foo/bar",
88 expected: 1,
89 },
90 {
91 components: []string{"bar"},
92 target: "foo/bar",
93 expected: 0,
94 },
95 {
96 components: []string{"foo", "bar"},
97 target: "foo/bar",
98 expected: 2,
99 },
100 } {
101 if got := commonPrefixComponents(tc.components, tc.target); !reflect.DeepEqual(got, tc.expected) {
102 t.Fatalf("expected %v, but got %v", tc.expected, got)
103 }
104 }
105}
106
107func TestSelectRepositoryMountCandidate(t *testing.T) {
108 for _, tc := range []struct {

Callers

nothing calls this directly

Calls 1

commonPrefixComponentsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…