@@ -17,7 +17,7 @@ package gencli
17
17
import (
18
18
"testing"
19
19
20
- "github.com/ golang/protobuf/protoc-gen-go/descriptor "
20
+ "google. golang.org /protobuf/types/descriptorpb "
21
21
)
22
22
23
23
func TestGenFlag (t * testing.T ) {
@@ -30,7 +30,7 @@ func TestGenFlag(t *testing.T) {
30
30
Name : "field" ,
31
31
FieldName : "Field" ,
32
32
VarName : "ClientInput" ,
33
- Type : descriptor .FieldDescriptorProto_TYPE_STRING ,
33
+ Type : descriptorpb .FieldDescriptorProto_TYPE_STRING ,
34
34
Usage : "this is the usage" ,
35
35
},
36
36
want : `StringVar(&ClientInput.Field, "field", "", "this is the usage")` ,
@@ -40,7 +40,7 @@ func TestGenFlag(t *testing.T) {
40
40
Name : "field" ,
41
41
FieldName : "Field" ,
42
42
VarName : "ClientInput" ,
43
- Type : descriptor .FieldDescriptorProto_TYPE_BOOL ,
43
+ Type : descriptorpb .FieldDescriptorProto_TYPE_BOOL ,
44
44
Usage : "this is the usage" ,
45
45
},
46
46
want : `BoolVar(&ClientInput.Field, "field", false, "this is the usage")` ,
@@ -50,7 +50,7 @@ func TestGenFlag(t *testing.T) {
50
50
Name : "field" ,
51
51
FieldName : "Field" ,
52
52
VarName : "ClientInput" ,
53
- Type : descriptor .FieldDescriptorProto_TYPE_INT32 ,
53
+ Type : descriptorpb .FieldDescriptorProto_TYPE_INT32 ,
54
54
Usage : "this is the usage" ,
55
55
},
56
56
want : `Int32Var(&ClientInput.Field, "field", 0, "this is the usage")` ,
@@ -60,7 +60,7 @@ func TestGenFlag(t *testing.T) {
60
60
Name : "field" ,
61
61
FieldName : "Field" ,
62
62
VarName : "ClientInput" ,
63
- Type : descriptor .FieldDescriptorProto_TYPE_FLOAT ,
63
+ Type : descriptorpb .FieldDescriptorProto_TYPE_FLOAT ,
64
64
Usage : "this is the usage" ,
65
65
},
66
66
want : `Float32Var(&ClientInput.Field, "field", 0.0, "this is the usage")` ,
@@ -70,7 +70,7 @@ func TestGenFlag(t *testing.T) {
70
70
Name : "field" ,
71
71
FieldName : "Field" ,
72
72
VarName : "ClientInput" ,
73
- Type : descriptor .FieldDescriptorProto_TYPE_DOUBLE ,
73
+ Type : descriptorpb .FieldDescriptorProto_TYPE_DOUBLE ,
74
74
Usage : "this is the usage" ,
75
75
},
76
76
want : `Float64Var(&ClientInput.Field, "field", 0.0, "this is the usage")` ,
@@ -80,7 +80,7 @@ func TestGenFlag(t *testing.T) {
80
80
Name : "field" ,
81
81
FieldName : "Field" ,
82
82
VarName : "ClientInput" ,
83
- Type : descriptor .FieldDescriptorProto_TYPE_BYTES ,
83
+ Type : descriptorpb .FieldDescriptorProto_TYPE_BYTES ,
84
84
Usage : "this is the usage" ,
85
85
},
86
86
want : `BytesHexVar(&ClientInput.Field, "field", []byte{}, "this is the usage")` ,
@@ -90,7 +90,7 @@ func TestGenFlag(t *testing.T) {
90
90
Name : "field" ,
91
91
FieldName : "Field" ,
92
92
VarName : "ClientInput" ,
93
- Type : descriptor .FieldDescriptorProto_TYPE_STRING ,
93
+ Type : descriptorpb .FieldDescriptorProto_TYPE_STRING ,
94
94
Usage : "this is the usage" ,
95
95
Repeated : true ,
96
96
},
@@ -100,7 +100,7 @@ func TestGenFlag(t *testing.T) {
100
100
f : & Flag {
101
101
Name : "field" ,
102
102
FieldName : "Field" ,
103
- Type : descriptor .FieldDescriptorProto_TYPE_MESSAGE ,
103
+ Type : descriptorpb .FieldDescriptorProto_TYPE_MESSAGE ,
104
104
Usage : "this is the usage" ,
105
105
Repeated : true ,
106
106
VarName : "ClientInputField" ,
@@ -111,7 +111,7 @@ func TestGenFlag(t *testing.T) {
111
111
f : & Flag {
112
112
Name : "field" ,
113
113
FieldName : "Field" ,
114
- Type : descriptor .FieldDescriptorProto_TYPE_ENUM ,
114
+ Type : descriptorpb .FieldDescriptorProto_TYPE_ENUM ,
115
115
Usage : "this is the usage" ,
116
116
VarName : "ClientInputField" ,
117
117
},
@@ -121,7 +121,7 @@ func TestGenFlag(t *testing.T) {
121
121
f : & Flag {
122
122
Name : "oneof.field" ,
123
123
FieldName : "Field" ,
124
- Type : descriptor .FieldDescriptorProto_TYPE_STRING ,
124
+ Type : descriptorpb .FieldDescriptorProto_TYPE_STRING ,
125
125
Usage : "this is the usage" ,
126
126
VarName : "ClientInputOneofField" ,
127
127
IsOneOfField : true ,
@@ -132,7 +132,7 @@ func TestGenFlag(t *testing.T) {
132
132
f : & Flag {
133
133
Name : "oneof_selector" ,
134
134
VarName : "ClientInputOneofSelector" ,
135
- Type : descriptor .FieldDescriptorProto_TYPE_STRING ,
135
+ Type : descriptorpb .FieldDescriptorProto_TYPE_STRING ,
136
136
Usage : "this is the usage" ,
137
137
OneOfs : map [string ]* Flag {"test" : & Flag {}},
138
138
},
@@ -151,11 +151,11 @@ func TestIsMessage(t *testing.T) {
151
151
want bool
152
152
}{
153
153
{
154
- f : & Flag {Type : descriptor .FieldDescriptorProto_TYPE_MESSAGE },
154
+ f : & Flag {Type : descriptorpb .FieldDescriptorProto_TYPE_MESSAGE },
155
155
want : true ,
156
156
},
157
157
{
158
- f : & Flag {Type : descriptor .FieldDescriptorProto_TYPE_STRING },
158
+ f : & Flag {Type : descriptorpb .FieldDescriptorProto_TYPE_STRING },
159
159
want : false ,
160
160
},
161
161
} {
@@ -171,11 +171,11 @@ func TestIsEnum(t *testing.T) {
171
171
want bool
172
172
}{
173
173
{
174
- f : & Flag {Type : descriptor .FieldDescriptorProto_TYPE_ENUM },
174
+ f : & Flag {Type : descriptorpb .FieldDescriptorProto_TYPE_ENUM },
175
175
want : true ,
176
176
},
177
177
{
178
- f : & Flag {Type : descriptor .FieldDescriptorProto_TYPE_STRING },
178
+ f : & Flag {Type : descriptorpb .FieldDescriptorProto_TYPE_STRING },
179
179
want : false ,
180
180
},
181
181
} {
0 commit comments