@@ -162,89 +162,67 @@ func TestUASTExtract(t *testing.T) {
162
162
name : "key_" + keyType ,
163
163
key : keyType ,
164
164
expected : []interface {}{
165
- []string {"FunctionDef" },
166
- []string {"Name" },
167
- []string {"Name" },
168
- []string {"Name" },
169
- []string {"Name" },
165
+ "FunctionDef" , "Name" , "Name" , "Name" , "Name" ,
170
166
},
171
167
},
172
168
{
173
169
name : "key_" + keyToken ,
174
170
key : keyToken ,
175
171
expected : []interface {}{
176
- []string {"sum" },
177
- []string {"a" },
178
- []string {"b" },
179
- []string {"print" },
180
- []string {"sum" },
172
+ "sum" , "a" , "b" , "print" , "sum" ,
181
173
},
182
174
},
183
175
{
184
176
name : "key_" + keyRoles ,
185
177
key : keyRoles ,
186
178
expected : []interface {}{
187
- [] string { "Unannotated" , "Function" , "Declaration" , "Name" , "Identifier" } ,
188
- [] string { "Unannotated" , "Identifier" , "Expression" , "Binary" , "Left" } ,
189
- [] string { "Unannotated" , "Identifier" , "Expression" , "Binary" , "Right" } ,
190
- [] string { "Unannotated" , "Identifier" , "Expression" , "Call" , "Callee" } ,
191
- [] string { "Unannotated" , "Identifier" , "Expression" , "Call" , "Callee" } ,
179
+ "Unannotated" , "Function" , "Declaration" , "Name" , "Identifier" ,
180
+ "Unannotated" , "Identifier" , "Expression" , "Binary" , "Left" ,
181
+ "Unannotated" , "Identifier" , "Expression" , "Binary" , "Right" ,
182
+ "Unannotated" , "Identifier" , "Expression" , "Call" , "Callee" ,
183
+ "Unannotated" , "Identifier" , "Expression" , "Call" , "Callee" ,
192
184
},
193
185
},
194
186
{
195
187
name : "key_" + keyStartPos ,
196
188
key : keyStartPos ,
197
189
expected : []interface {}{
198
- [] string { "Offset:28 Line:4 Col:5 " } ,
199
- [] string { "Offset:47 Line:5 Col:9 " } ,
200
- [] string { "Offset:51 Line:5 Col:13 " } ,
201
- [] string { "Offset:54 Line:7 Col:1 " } ,
202
- [] string { "Offset:60 Line:7 Col:7 " } ,
190
+ "Offset:28 Line:4 Col:5 " ,
191
+ "Offset:47 Line:5 Col:9 " ,
192
+ "Offset:51 Line:5 Col:13 " ,
193
+ "Offset:54 Line:7 Col:1 " ,
194
+ "Offset:60 Line:7 Col:7 " ,
203
195
},
204
196
},
205
197
{
206
198
name : "key_" + keyEndPos ,
207
199
key : keyEndPos ,
208
200
expected : []interface {}{
209
- [] string { "Offset:31 Line:4 Col:8 " } ,
210
- [] string { "Offset:48 Line:5 Col:10 " } ,
211
- [] string { "Offset:52 Line:5 Col:14 " } ,
212
- [] string { "Offset:59 Line:7 Col:6 " } ,
213
- [] string { "Offset:63 Line:7 Col:10 " } ,
201
+ "Offset:31 Line:4 Col:8 " ,
202
+ "Offset:48 Line:5 Col:10 " ,
203
+ "Offset:52 Line:5 Col:14 " ,
204
+ "Offset:59 Line:7 Col:6 " ,
205
+ "Offset:63 Line:7 Col:10 " ,
214
206
},
215
207
},
216
208
{
217
209
name : "key_internalRole" ,
218
210
key : "internalRole" ,
219
211
expected : []interface {}{
220
- []string {"body" },
221
- []string {"left" },
222
- []string {"right" },
223
- []string {"func" },
224
- []string {"func" },
212
+ "body" , "left" , "right" , "func" , "func" ,
225
213
},
226
214
},
227
215
{
228
216
name : "key_ctx" ,
229
217
key : "ctx" ,
230
218
expected : []interface {}{
231
- []string {},
232
- []string {"Load" },
233
- []string {"Load" },
234
- []string {"Load" },
235
- []string {"Load" },
219
+ "Load" , "Load" , "Load" , "Load" ,
236
220
},
237
221
},
238
222
{
239
- name : "key_foo" ,
240
- key : "foo" ,
241
- expected : []interface {}{
242
- []string {},
243
- []string {},
244
- []string {},
245
- []string {},
246
- []string {},
247
- },
223
+ name : "key_foo" ,
224
+ key : "foo" ,
225
+ expected : nil ,
248
226
},
249
227
}
250
228
0 commit comments