@@ -23,19 +23,22 @@ import (
23
23
func TestUnspecified (t * testing.T ) {
24
24
tests := []struct {
25
25
testName string
26
+ EnumName string
26
27
ValueName string
27
28
problems testutils.Problems
28
29
}{
29
- {"Valid" , "BOOK_FORMAT_UNSPECIFIED" , testutils.Problems {}},
30
- {"InvalidNoPrefix" , "UNSPECIFIED" , testutils.Problems {{Suggestion : "BOOK_FORMAT_UNSPECIFIED" }}},
31
- {"InvalidWrongSuffix" , "BOOK_FORMAT_UNKNOWN" , testutils.Problems {{Suggestion : "BOOK_FORMAT_UNSPECIFIED" }}},
32
- {"InvalidJustWrong" , "UNKNOWN" , testutils.Problems {{Suggestion : "BOOK_FORMAT_UNSPECIFIED" }}},
30
+ {"Valid" , "BookFormat" , "BOOK_FORMAT_UNSPECIFIED" , testutils.Problems {}},
31
+ {"ValidWithNum" , "Ipv6Format" , "IPV6_FORMAT_UNSPECIFIED" , nil },
32
+ {"InvalidNoPrefix" , "BookFormat" , "UNSPECIFIED" , testutils.Problems {{Suggestion : "BOOK_FORMAT_UNSPECIFIED" }}},
33
+ {"InvalidWrongSuffix" , "BookFormat" , "BOOK_FORMAT_UNKNOWN" , testutils.Problems {{Suggestion : "BOOK_FORMAT_UNSPECIFIED" }}},
34
+ {"InvalidJustWrong" , "BookFormat" , "UNKNOWN" , testutils.Problems {{Suggestion : "BOOK_FORMAT_UNSPECIFIED" }}},
35
+ {"InvalidWithNum" , "Ipv6Format" , "IPV6FORMAT_UNSPECIFIED" , testutils.Problems {{Suggestion : "IPV6_FORMAT_UNSPECIFIED" }}},
33
36
}
34
37
for _ , test := range tests {
35
38
t .Run (test .testName , func (t * testing.T ) {
36
39
// Create the proto with the enum.
37
40
f := testutils .ParseProto3Tmpl (t , `
38
- enum BookFormat {
41
+ enum {{.EnumName}} {
39
42
{{.ValueName}} = 0;
40
43
HARDBACK = 1;
41
44
PAPERBACK = 2;
@@ -53,8 +56,8 @@ func TestUnspecified(t *testing.T) {
53
56
t .Run (test .testName , func (t * testing.T ) {
54
57
// Create the proto with the enum.
55
58
f := testutils .ParseProto3Tmpl (t , `
56
- enum BookFormat {
57
- option allow_alias = true;
59
+ enum {{.EnumName}} {
60
+ option allow_alias = true;
58
61
HARDBACK = 0;
59
62
{{.ValueName}} = 0;
60
63
PAPERBACK = 1;
0 commit comments