MCPcopy Create free account
hub / github.com/cortexproject/cortex / Test_findFlagsPrefix

Function Test_findFlagsPrefix

tools/doc-generator/util_test.go:9–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func Test_findFlagsPrefix(t *testing.T) {
10 tests := []struct {
11 input []string
12 expected []string
13 }{
14 {
15 input: []string{},
16 expected: []string{},
17 },
18 {
19 input: []string{""},
20 expected: []string{""},
21 },
22 {
23 input: []string{"", ""},
24 expected: []string{"", ""},
25 },
26 {
27 input: []string{"foo", "foo", "foo"},
28 expected: []string{"", "", ""},
29 },
30 {
31 input: []string{"ruler.endpoint", "alertmanager.endpoint"},
32 expected: []string{"ruler", "alertmanager"},
33 },
34 {
35 input: []string{"ruler.endpoint.address", "alertmanager.endpoint.address"},
36 expected: []string{"ruler", "alertmanager"},
37 },
38 {
39 input: []string{"ruler.first.address", "ruler.second.address"},
40 expected: []string{"ruler.first", "ruler.second"},
41 },
42 }
43
44 for _, test := range tests {
45 assert.Equal(t, test.expected, findFlagsPrefix(test.input))
46 }
47}

Callers

nothing calls this directly

Calls 2

findFlagsPrefixFunction · 0.85
EqualMethod · 0.65

Tested by

no test coverage detected