Skip to content

Commit bd158ac

Browse files
committed
wit: add additional name tests
1 parent 5b1807a commit bd158ac

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

wit/ident_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ func TestIdent(t *testing.T) {
2424
{"%use:%own/%type", Ident{Namespace: "use", Package: "own", Extension: "type"}, false},
2525
{"%use:%own/%[email protected]", Ident{Namespace: "use", Package: "own", Extension: "type", Version: semver.New("0.2.0")}, false},
2626

27+
// Mixed-case
28+
{"ABC:def-GHI", Ident{Namespace: "ABC", Package: "def-GHI"}, false},
29+
{"ABC1:def2-GHI3", Ident{Namespace: "ABC1", Package: "def2-GHI3"}, false},
30+
2731
// Errors
2832
{"", Ident{}, true},
2933
{":", Ident{}, true},
@@ -35,6 +39,14 @@ func TestIdent(t *testing.T) {
3539
{"wasi:clocks@", Ident{}, true},
3640
{"wasi:clocks/wall-clock@", Ident{}, true},
3741
{"foo%:bar%baz", Ident{Namespace: "foo%", Package: "bar%baz"}, true},
42+
{"-foo:bar", Ident{Namespace: "-foo", Package: "bar"}, true},
43+
{"foo-:bar", Ident{Namespace: "foo-", Package: "bar"}, true},
44+
{"foo--foo:bar", Ident{Namespace: "foo--foo", Package: "bar"}, true},
45+
{"aBc:bar", Ident{Namespace: "aBc", Package: "bar"}, true},
46+
{"1:2", Ident{Namespace: "1", Package: "2"}, true},
47+
{"1a:2b", Ident{Namespace: "1a", Package: "2b"}, true},
48+
{"foo-1:bar", Ident{Namespace: "foo-1", Package: "bar"}, true},
49+
{"foo:bar-1", Ident{Namespace: "foo", Package: "bar-2"}, true},
3850
}
3951
for _, tt := range tests {
4052
t.Run(tt.s, func(t *testing.T) {

0 commit comments

Comments
 (0)