30
30
package test
31
31
32
32
import (
33
- "arduino.cc/builder/constants"
34
33
"arduino.cc/builder/ctags"
35
34
"arduino.cc/builder/types"
36
35
"github.com/stretchr/testify/require"
@@ -46,12 +45,12 @@ func TestCTagsParserShouldListPrototypes(t *testing.T) {
46
45
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldListPrototypes.txt" ))
47
46
NoError (t , err )
48
47
49
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
48
+ ctx . CTagsOutput = string (bytes )
50
49
51
50
ctagsParser := ctags.CTagsParser {}
52
51
ctagsParser .Run (context , ctx )
53
52
54
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
53
+ tags := ctx . CTagsOfPreprocessedSource
55
54
56
55
require .Equal (t , 8 , len (tags ))
57
56
idx := 0
@@ -95,12 +94,12 @@ func TestCTagsParserShouldListTemplates(t *testing.T) {
95
94
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldListTemplates.txt" ))
96
95
NoError (t , err )
97
96
98
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
97
+ ctx . CTagsOutput = string (bytes )
99
98
100
99
ctagsParser := ctags.CTagsParser {}
101
100
ctagsParser .Run (context , ctx )
102
101
103
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
102
+ tags := ctx . CTagsOfPreprocessedSource
104
103
105
104
require .Equal (t , 3 , len (tags ))
106
105
idx := 0
@@ -124,12 +123,12 @@ func TestCTagsParserShouldListTemplates2(t *testing.T) {
124
123
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldListTemplates2.txt" ))
125
124
NoError (t , err )
126
125
127
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
126
+ ctx . CTagsOutput = string (bytes )
128
127
129
128
ctagsParser := ctags.CTagsParser {}
130
129
ctagsParser .Run (context , ctx )
131
130
132
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
131
+ tags := ctx . CTagsOfPreprocessedSource
133
132
134
133
require .Equal (t , 4 , len (tags ))
135
134
idx := 0
@@ -155,12 +154,12 @@ func TestCTagsParserShouldDealWithClasses(t *testing.T) {
155
154
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldDealWithClasses.txt" ))
156
155
NoError (t , err )
157
156
158
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
157
+ ctx . CTagsOutput = string (bytes )
159
158
160
159
ctagsParser := ctags.CTagsParser {}
161
160
ctagsParser .Run (context , ctx )
162
161
163
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
162
+ tags := ctx . CTagsOfPreprocessedSource
164
163
165
164
require .Equal (t , 2 , len (tags ))
166
165
idx := 0
@@ -178,12 +177,12 @@ func TestCTagsParserShouldDealWithStructs(t *testing.T) {
178
177
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldDealWithStructs.txt" ))
179
178
NoError (t , err )
180
179
181
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
180
+ ctx . CTagsOutput = string (bytes )
182
181
183
182
ctagsParser := ctags.CTagsParser {}
184
183
ctagsParser .Run (context , ctx )
185
184
186
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
185
+ tags := ctx . CTagsOfPreprocessedSource
187
186
188
187
require .Equal (t , 5 , len (tags ))
189
188
idx := 0
@@ -211,12 +210,12 @@ func TestCTagsParserShouldDealWithMacros(t *testing.T) {
211
210
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldDealWithMacros.txt" ))
212
211
NoError (t , err )
213
212
214
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
213
+ ctx . CTagsOutput = string (bytes )
215
214
216
215
ctagsParser := ctags.CTagsParser {}
217
216
ctagsParser .Run (context , ctx )
218
217
219
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
218
+ tags := ctx . CTagsOfPreprocessedSource
220
219
221
220
require .Equal (t , 8 , len (tags ))
222
221
idx := 0
@@ -252,12 +251,12 @@ func TestCTagsParserShouldDealFunctionWithDifferentSignatures(t *testing.T) {
252
251
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldDealFunctionWithDifferentSignatures.txt" ))
253
252
NoError (t , err )
254
253
255
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
254
+ ctx . CTagsOutput = string (bytes )
256
255
257
256
ctagsParser := ctags.CTagsParser {}
258
257
ctagsParser .Run (context , ctx )
259
258
260
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
259
+ tags := ctx . CTagsOfPreprocessedSource
261
260
262
261
require .Equal (t , 3 , len (tags ))
263
262
idx := 0
@@ -278,12 +277,12 @@ func TestCTagsParserClassMembersAreFilteredOut(t *testing.T) {
278
277
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserClassMembersAreFilteredOut.txt" ))
279
278
NoError (t , err )
280
279
281
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
280
+ ctx . CTagsOutput = string (bytes )
282
281
283
282
ctagsParser := ctags.CTagsParser {}
284
283
ctagsParser .Run (context , ctx )
285
284
286
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
285
+ tags := ctx . CTagsOfPreprocessedSource
287
286
288
287
require .Equal (t , 5 , len (tags ))
289
288
idx := 0
@@ -313,12 +312,12 @@ func TestCTagsParserStructWithFunctions(t *testing.T) {
313
312
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserStructWithFunctions.txt" ))
314
313
NoError (t , err )
315
314
316
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
315
+ ctx . CTagsOutput = string (bytes )
317
316
318
317
ctagsParser := ctags.CTagsParser {}
319
318
ctagsParser .Run (context , ctx )
320
319
321
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
320
+ tags := ctx . CTagsOfPreprocessedSource
322
321
323
322
require .Equal (t , 8 , len (tags ))
324
323
idx := 0
@@ -356,12 +355,12 @@ func TestCTagsParserDefaultArguments(t *testing.T) {
356
355
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserDefaultArguments.txt" ))
357
356
NoError (t , err )
358
357
359
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
358
+ ctx . CTagsOutput = string (bytes )
360
359
361
360
ctagsParser := ctags.CTagsParser {}
362
361
ctagsParser .Run (context , ctx )
363
362
364
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
363
+ tags := ctx . CTagsOfPreprocessedSource
365
364
366
365
require .Equal (t , 3 , len (tags ))
367
366
idx := 0
@@ -383,12 +382,12 @@ func TestCTagsParserNamespace(t *testing.T) {
383
382
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserNamespace.txt" ))
384
383
NoError (t , err )
385
384
386
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
385
+ ctx . CTagsOutput = string (bytes )
387
386
388
387
ctagsParser := ctags.CTagsParser {}
389
388
ctagsParser .Run (context , ctx )
390
389
391
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
390
+ tags := ctx . CTagsOfPreprocessedSource
392
391
393
392
require .Equal (t , 3 , len (tags ))
394
393
idx := 0
@@ -410,12 +409,12 @@ func TestCTagsParserStatic(t *testing.T) {
410
409
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserStatic.txt" ))
411
410
NoError (t , err )
412
411
413
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
412
+ ctx . CTagsOutput = string (bytes )
414
413
415
414
ctagsParser := ctags.CTagsParser {}
416
415
ctagsParser .Run (context , ctx )
417
416
418
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
417
+ tags := ctx . CTagsOfPreprocessedSource
419
418
420
419
require .Equal (t , 3 , len (tags ))
421
420
idx := 0
@@ -436,12 +435,12 @@ func TestCTagsParserFunctionPointer(t *testing.T) {
436
435
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserFunctionPointer.txt" ))
437
436
NoError (t , err )
438
437
439
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
438
+ ctx . CTagsOutput = string (bytes )
440
439
441
440
ctagsParser := ctags.CTagsParser {}
442
441
ctagsParser .Run (context , ctx )
443
442
444
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
443
+ tags := ctx . CTagsOfPreprocessedSource
445
444
446
445
require .Equal (t , 4 , len (tags ))
447
446
idx := 0
@@ -465,12 +464,12 @@ func TestCTagsParserFunctionPointers(t *testing.T) {
465
464
bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserFunctionPointers.txt" ))
466
465
NoError (t , err )
467
466
468
- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
467
+ ctx . CTagsOutput = string (bytes )
469
468
470
469
ctagsParser := ctags.CTagsParser {}
471
470
ctagsParser .Run (context , ctx )
472
471
473
- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
472
+ tags := ctx . CTagsOfPreprocessedSource
474
473
475
474
require .Equal (t , 5 , len (tags ))
476
475
idx := 0
0 commit comments