diff options
author | Matthew Holt <[email protected]> | 2019-12-31 22:51:55 -0700 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-12-31 22:51:55 -0700 |
commit | 3d9f8eac08e172d99eafb396f161263fd444c073 (patch) | |
tree | 747de0d1ee29c819a61ec4d2a2dfc723f6732a7b /modules_test.go | |
parent | 06ea0a52950ef6d1dd327c10e247ada1b71a5c5d (diff) | |
download | caddy-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.go | 33 |
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) + } + } +} |