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

Function TestModuleID

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

Source from the content-addressed store, hash-verified

85}
86
87func TestModuleID(t *testing.T) {
88 for i, tc := range []struct {
89 input ModuleID
90 expectNamespace string
91 expectName string
92 }{
93 {
94 input: "foo",
95 expectNamespace: "",
96 expectName: "foo",
97 },
98 {
99 input: "foo.bar",
100 expectNamespace: "foo",
101 expectName: "bar",
102 },
103 {
104 input: "a.b.c",
105 expectNamespace: "a.b",
106 expectName: "c",
107 },
108 } {
109 actualNamespace := tc.input.Namespace()
110 if actualNamespace != tc.expectNamespace {
111 t.Errorf("Test %d: Expected namespace '%s' but got '%s'", i, tc.expectNamespace, actualNamespace)
112 }
113 actualName := tc.input.Name()
114 if actualName != tc.expectName {
115 t.Errorf("Test %d: Expected name '%s' but got '%s'", i, tc.expectName, actualName)
116 }
117 }
118}

Callers

nothing calls this directly

Calls 2

NamespaceMethod · 0.80
NameMethod · 0.45

Tested by

no test coverage detected