MCPcopy
hub / github.com/github/git-sizer / TestConfigKeyMatchesPrefix

Function TestConfigKeyMatchesPrefix

git/gitconfig_test.go:10–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestConfigKeyMatchesPrefix(t *testing.T) {
11 for _, p := range []struct {
12 key, prefix string
13 expectedBool bool
14 expectedString string
15 }{
16 {"foo.bar", "", true, "foo.bar"},
17 {"foo.bar", "foo", true, "bar"},
18 {"foo.bar", "foo.", true, "bar"},
19 {"foo.bar", "foo.bar", true, ""},
20 {"foo.bar", "foo.bar.", false, ""},
21 {"foo.bar", "foo.bar.baz", false, ""},
22 {"foo.bar", "foo.barbaz", false, ""},
23 {"foo.bar.baz", "foo.bar", true, "baz"},
24 {"foo.barbaz", "foo.bar", false, ""},
25 {"foo.bar", "bar", false, ""},
26 } {
27 t.Run(
28 fmt.Sprintf("TestConfigKeyMatchesPrefix(%q, %q)", p.key, p.prefix),
29 func(t *testing.T) {
30 ok, s := configKeyMatchesPrefix(p.key, p.prefix)
31 assert.Equal(t, p.expectedBool, ok)
32 assert.Equal(t, p.expectedString, s)
33 },
34 )
35 }
36}

Callers

nothing calls this directly

Calls 2

configKeyMatchesPrefixFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected