summaryrefslogtreecommitdiff
path: root/modules_test.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-12-31 22:51:55 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2019-12-31 22:51:55 -0700
commit3d9f8eac08e172d99eafb396f161263fd444c073 (patch)
tree747de0d1ee29c819a61ec4d2a2dfc723f6732a7b /modules_test.go
parent06ea0a52950ef6d1dd327c10e247ada1b71a5c5d (diff)
Couple of minor fixes, update readme
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 c561c6f..cadc477 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)
+ }
+ }
+}