aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules_test.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2019-12-31 22:51:55 -0700
committerMatthew Holt <[email protected]>2019-12-31 22:51:55 -0700
commit3d9f8eac08e172d99eafb396f161263fd444c073 (patch)
tree747de0d1ee29c819a61ec4d2a2dfc723f6732a7b /modules_test.go
parent06ea0a52950ef6d1dd327c10e247ada1b71a5c5d (diff)
downloadcaddy-3d9f8eac08e172d99eafb396f161263fd444c073.tar.gz
caddy-3d9f8eac08e172d99eafb396f161263fd444c073.zip
Couple of minor fixes, update readmev2.0.0-beta12
Diffstat (limited to 'modules_test.go')
-rw-r--r--modules_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/modules_test.go b/modules_test.go
index c561c6f45..cadc47735 100644
--- a/modules_test.go
+++ b/modules_test.go
@@ -83,3 +83,36 @@ func TestGetModules(t *testing.T) {
}
}
}
+
+func TestModuleID(t *testing.T) {
+ for i, tc := range []struct {
+ input ModuleID
+ expectNamespace string
+ expectName string
+ }{
+ {
+ input: "foo",
+ expectNamespace: "",
+ expectName: "foo",
+ },
+ {
+ input: "foo.bar",
+ expectNamespace: "foo",
+ expectName: "bar",
+ },
+ {
+ input: "a.b.c",
+ expectNamespace: "a.b",
+ expectName: "c",
+ },
+ } {
+ actualNamespace := tc.input.Namespace()
+ if actualNamespace != tc.expectNamespace {
+ t.Errorf("Test %d: Expected namespace '%s' but got '%s'", i, tc.expectNamespace, actualNamespace)
+ }
+ actualName := tc.input.Name()
+ if actualName != tc.expectName {
+ t.Errorf("Test %d: Expected name '%s' but got '%s'", i, tc.expectName, actualName)
+ }
+ }
+}