...
1 package internal
2
3 import (
4 "testing"
5 )
6
7 func TestIdentifier(t *testing.T) {
8 testcases := []struct {
9 in, out string
10 }{
11 {".rodata", "Rodata"},
12 {"_foo_bar_", "FooBar"},
13 {"ipv6_test", "Ipv6Test"},
14 {"FOO_BAR", "FOO_BAR"},
15 {"FOO_", "FOO_"},
16 {"FOO__BAR", "FOO__BAR"},
17 {"FOO___BAR", "FOO___BAR"},
18 {"_FOO__BAR", "FOO__BAR"},
19 {"__FOO__BAR", "FOO__BAR"},
20 }
21
22 for _, tc := range testcases {
23 have := Identifier(tc.in)
24 if have != tc.out {
25 t.Errorf("Expected %q as output of %q, got %q", tc.out, tc.in, have)
26 }
27 }
28 }
29
View as plain text