3030package test
3131
3232import (
33- "arduino.cc/builder/constants"
3433 "arduino.cc/builder/ctags"
3534 "arduino.cc/builder/types"
3635 "github.com/stretchr/testify/require"
@@ -46,12 +45,12 @@ func TestCTagsParserShouldListPrototypes(t *testing.T) {
4645 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldListPrototypes.txt" ))
4746 NoError (t , err )
4847
49- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
48+ ctx . CTagsOutput = string (bytes )
5049
5150 ctagsParser := ctags.CTagsParser {}
5251 ctagsParser .Run (context , ctx )
5352
54- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
53+ tags := ctx . CTagsOfPreprocessedSource
5554
5655 require .Equal (t , 8 , len (tags ))
5756 idx := 0
@@ -95,12 +94,12 @@ func TestCTagsParserShouldListTemplates(t *testing.T) {
9594 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldListTemplates.txt" ))
9695 NoError (t , err )
9796
98- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
97+ ctx . CTagsOutput = string (bytes )
9998
10099 ctagsParser := ctags.CTagsParser {}
101100 ctagsParser .Run (context , ctx )
102101
103- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
102+ tags := ctx . CTagsOfPreprocessedSource
104103
105104 require .Equal (t , 3 , len (tags ))
106105 idx := 0
@@ -124,12 +123,12 @@ func TestCTagsParserShouldListTemplates2(t *testing.T) {
124123 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldListTemplates2.txt" ))
125124 NoError (t , err )
126125
127- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
126+ ctx . CTagsOutput = string (bytes )
128127
129128 ctagsParser := ctags.CTagsParser {}
130129 ctagsParser .Run (context , ctx )
131130
132- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
131+ tags := ctx . CTagsOfPreprocessedSource
133132
134133 require .Equal (t , 4 , len (tags ))
135134 idx := 0
@@ -155,12 +154,12 @@ func TestCTagsParserShouldDealWithClasses(t *testing.T) {
155154 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldDealWithClasses.txt" ))
156155 NoError (t , err )
157156
158- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
157+ ctx . CTagsOutput = string (bytes )
159158
160159 ctagsParser := ctags.CTagsParser {}
161160 ctagsParser .Run (context , ctx )
162161
163- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
162+ tags := ctx . CTagsOfPreprocessedSource
164163
165164 require .Equal (t , 2 , len (tags ))
166165 idx := 0
@@ -178,12 +177,12 @@ func TestCTagsParserShouldDealWithStructs(t *testing.T) {
178177 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldDealWithStructs.txt" ))
179178 NoError (t , err )
180179
181- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
180+ ctx . CTagsOutput = string (bytes )
182181
183182 ctagsParser := ctags.CTagsParser {}
184183 ctagsParser .Run (context , ctx )
185184
186- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
185+ tags := ctx . CTagsOfPreprocessedSource
187186
188187 require .Equal (t , 5 , len (tags ))
189188 idx := 0
@@ -211,12 +210,12 @@ func TestCTagsParserShouldDealWithMacros(t *testing.T) {
211210 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldDealWithMacros.txt" ))
212211 NoError (t , err )
213212
214- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
213+ ctx . CTagsOutput = string (bytes )
215214
216215 ctagsParser := ctags.CTagsParser {}
217216 ctagsParser .Run (context , ctx )
218217
219- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
218+ tags := ctx . CTagsOfPreprocessedSource
220219
221220 require .Equal (t , 8 , len (tags ))
222221 idx := 0
@@ -252,12 +251,12 @@ func TestCTagsParserShouldDealFunctionWithDifferentSignatures(t *testing.T) {
252251 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserShouldDealFunctionWithDifferentSignatures.txt" ))
253252 NoError (t , err )
254253
255- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
254+ ctx . CTagsOutput = string (bytes )
256255
257256 ctagsParser := ctags.CTagsParser {}
258257 ctagsParser .Run (context , ctx )
259258
260- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
259+ tags := ctx . CTagsOfPreprocessedSource
261260
262261 require .Equal (t , 3 , len (tags ))
263262 idx := 0
@@ -278,12 +277,12 @@ func TestCTagsParserClassMembersAreFilteredOut(t *testing.T) {
278277 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserClassMembersAreFilteredOut.txt" ))
279278 NoError (t , err )
280279
281- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
280+ ctx . CTagsOutput = string (bytes )
282281
283282 ctagsParser := ctags.CTagsParser {}
284283 ctagsParser .Run (context , ctx )
285284
286- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
285+ tags := ctx . CTagsOfPreprocessedSource
287286
288287 require .Equal (t , 5 , len (tags ))
289288 idx := 0
@@ -313,12 +312,12 @@ func TestCTagsParserStructWithFunctions(t *testing.T) {
313312 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserStructWithFunctions.txt" ))
314313 NoError (t , err )
315314
316- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
315+ ctx . CTagsOutput = string (bytes )
317316
318317 ctagsParser := ctags.CTagsParser {}
319318 ctagsParser .Run (context , ctx )
320319
321- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
320+ tags := ctx . CTagsOfPreprocessedSource
322321
323322 require .Equal (t , 8 , len (tags ))
324323 idx := 0
@@ -356,12 +355,12 @@ func TestCTagsParserDefaultArguments(t *testing.T) {
356355 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserDefaultArguments.txt" ))
357356 NoError (t , err )
358357
359- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
358+ ctx . CTagsOutput = string (bytes )
360359
361360 ctagsParser := ctags.CTagsParser {}
362361 ctagsParser .Run (context , ctx )
363362
364- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
363+ tags := ctx . CTagsOfPreprocessedSource
365364
366365 require .Equal (t , 3 , len (tags ))
367366 idx := 0
@@ -383,12 +382,12 @@ func TestCTagsParserNamespace(t *testing.T) {
383382 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserNamespace.txt" ))
384383 NoError (t , err )
385384
386- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
385+ ctx . CTagsOutput = string (bytes )
387386
388387 ctagsParser := ctags.CTagsParser {}
389388 ctagsParser .Run (context , ctx )
390389
391- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
390+ tags := ctx . CTagsOfPreprocessedSource
392391
393392 require .Equal (t , 3 , len (tags ))
394393 idx := 0
@@ -410,12 +409,12 @@ func TestCTagsParserStatic(t *testing.T) {
410409 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserStatic.txt" ))
411410 NoError (t , err )
412411
413- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
412+ ctx . CTagsOutput = string (bytes )
414413
415414 ctagsParser := ctags.CTagsParser {}
416415 ctagsParser .Run (context , ctx )
417416
418- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
417+ tags := ctx . CTagsOfPreprocessedSource
419418
420419 require .Equal (t , 3 , len (tags ))
421420 idx := 0
@@ -436,12 +435,12 @@ func TestCTagsParserFunctionPointer(t *testing.T) {
436435 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserFunctionPointer.txt" ))
437436 NoError (t , err )
438437
439- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
438+ ctx . CTagsOutput = string (bytes )
440439
441440 ctagsParser := ctags.CTagsParser {}
442441 ctagsParser .Run (context , ctx )
443442
444- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
443+ tags := ctx . CTagsOfPreprocessedSource
445444
446445 require .Equal (t , 4 , len (tags ))
447446 idx := 0
@@ -465,12 +464,12 @@ func TestCTagsParserFunctionPointers(t *testing.T) {
465464 bytes , err := ioutil .ReadFile (filepath .Join ("ctags_output" , "TestCTagsParserFunctionPointers.txt" ))
466465 NoError (t , err )
467466
468- context [ constants . CTX_CTAGS_OUTPUT ] = string (bytes )
467+ ctx . CTagsOutput = string (bytes )
469468
470469 ctagsParser := ctags.CTagsParser {}
471470 ctagsParser .Run (context , ctx )
472471
473- tags := context [ constants . CTX_CTAGS_OF_PREPROC_SOURCE ].([] * types. CTag )
472+ tags := ctx . CTagsOfPreprocessedSource
474473
475474 require .Equal (t , 5 , len (tags ))
476475 idx := 0
0 commit comments