MCPcopy
hub / github.com/caddyserver/caddy / TestGetModules

Function TestGetModules

modules_test.go:22–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20)
21
22func TestGetModules(t *testing.T) {
23 modulesMu.Lock()
24 modules = map[string]ModuleInfo{
25 "a": {ID: "a"},
26 "a.b": {ID: "a.b"},
27 "a.b.c": {ID: "a.b.c"},
28 "a.b.cd": {ID: "a.b.cd"},
29 "a.c": {ID: "a.c"},
30 "a.d": {ID: "a.d"},
31 "b": {ID: "b"},
32 "b.a": {ID: "b.a"},
33 "b.b": {ID: "b.b"},
34 "b.a.c": {ID: "b.a.c"},
35 "c": {ID: "c"},
36 }
37 modulesMu.Unlock()
38
39 for i, tc := range []struct {
40 input string
41 expect []ModuleInfo
42 }{
43 {
44 input: "",
45 expect: []ModuleInfo{
46 {ID: "a"},
47 {ID: "b"},
48 {ID: "c"},
49 },
50 },
51 {
52 input: "a",
53 expect: []ModuleInfo{
54 {ID: "a.b"},
55 {ID: "a.c"},
56 {ID: "a.d"},
57 },
58 },
59 {
60 input: "a.b",
61 expect: []ModuleInfo{
62 {ID: "a.b.c"},
63 {ID: "a.b.cd"},
64 },
65 },
66 {
67 input: "a.b.c",
68 },
69 {
70 input: "b",
71 expect: []ModuleInfo{
72 {ID: "b.a"},
73 {ID: "b.b"},
74 },
75 },
76 {
77 input: "asdf",
78 },
79 } {

Callers

nothing calls this directly

Calls 1

GetModulesFunction · 0.85

Tested by

no test coverage detected