@@ -29,6 +29,12 @@ import (
29
29
"github.com/stretchr/testify/require"
30
30
)
31
31
32
+ func loadPreprocessedSketch (t * testing.T , ctx * types.Context ) string {
33
+ res , err := ctx .SketchBuildPath .Join (ctx .Sketch .MainFile .Base () + ".cpp" ).ReadFile ()
34
+ NoError (t , err )
35
+ return string (res )
36
+ }
37
+
32
38
func TestPrototypesAdderBridgeExample (t * testing.T ) {
33
39
DownloadCoresAndToolsAndLibraries (t )
34
40
@@ -63,8 +69,9 @@ func TestPrototypesAdderBridgeExample(t *testing.T) {
63
69
}
64
70
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
65
71
66
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
67
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 33 " + quotedSketchLocation + "\n void setup();\n #line 46 " + quotedSketchLocation + "\n void loop();\n #line 62 " + quotedSketchLocation + "\n void process(BridgeClient client);\n #line 82 " + quotedSketchLocation + "\n void digitalCommand(BridgeClient client);\n #line 109 " + quotedSketchLocation + "\n void analogCommand(BridgeClient client);\n #line 149 " + quotedSketchLocation + "\n void modeCommand(BridgeClient client);\n #line 33 " + quotedSketchLocation + "\n " )
72
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
73
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
74
+ require .Contains (t , preprocessedSketch , "#line 33 " + quotedSketchLocation + "\n void setup();\n #line 46 " + quotedSketchLocation + "\n void loop();\n #line 62 " + quotedSketchLocation + "\n void process(BridgeClient client);\n #line 82 " + quotedSketchLocation + "\n void digitalCommand(BridgeClient client);\n #line 109 " + quotedSketchLocation + "\n void analogCommand(BridgeClient client);\n #line 149 " + quotedSketchLocation + "\n void modeCommand(BridgeClient client);\n #line 33 " + quotedSketchLocation + "\n " )
68
75
}
69
76
70
77
func TestPrototypesAdderSketchWithIfDef (t * testing.T ) {
@@ -99,7 +106,8 @@ func TestPrototypesAdderSketchWithIfDef(t *testing.T) {
99
106
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
100
107
101
108
preprocessed := LoadAndInterpolate (t , filepath .Join ("SketchWithIfDef" , "SketchWithIfDef.preprocessed.txt" ), ctx )
102
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
109
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
110
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
103
111
}
104
112
105
113
func TestPrototypesAdderBaladuino (t * testing.T ) {
@@ -134,7 +142,8 @@ func TestPrototypesAdderBaladuino(t *testing.T) {
134
142
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
135
143
136
144
preprocessed := LoadAndInterpolate (t , filepath .Join ("Baladuino" , "Baladuino.preprocessed.txt" ), ctx )
137
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
145
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
146
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
138
147
}
139
148
140
149
func TestPrototypesAdderCharWithEscapedDoubleQuote (t * testing.T ) {
@@ -169,7 +178,8 @@ func TestPrototypesAdderCharWithEscapedDoubleQuote(t *testing.T) {
169
178
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
170
179
171
180
preprocessed := LoadAndInterpolate (t , filepath .Join ("CharWithEscapedDoubleQuote" , "CharWithEscapedDoubleQuote.preprocessed.txt" ), ctx )
172
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
181
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
182
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
173
183
}
174
184
175
185
func TestPrototypesAdderIncludeBetweenMultilineComment (t * testing.T ) {
@@ -204,7 +214,8 @@ func TestPrototypesAdderIncludeBetweenMultilineComment(t *testing.T) {
204
214
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
205
215
206
216
preprocessed := LoadAndInterpolate (t , filepath .Join ("IncludeBetweenMultilineComment" , "IncludeBetweenMultilineComment.preprocessed.txt" ), ctx )
207
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
217
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
218
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
208
219
}
209
220
210
221
func TestPrototypesAdderLineContinuations (t * testing.T ) {
@@ -239,7 +250,8 @@ func TestPrototypesAdderLineContinuations(t *testing.T) {
239
250
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
240
251
241
252
preprocessed := LoadAndInterpolate (t , filepath .Join ("LineContinuations" , "LineContinuations.preprocessed.txt" ), ctx )
242
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
253
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
254
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
243
255
}
244
256
245
257
func TestPrototypesAdderStringWithComment (t * testing.T ) {
@@ -274,7 +286,8 @@ func TestPrototypesAdderStringWithComment(t *testing.T) {
274
286
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
275
287
276
288
preprocessed := LoadAndInterpolate (t , filepath .Join ("StringWithComment" , "StringWithComment.preprocessed.txt" ), ctx )
277
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
289
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
290
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
278
291
}
279
292
280
293
func TestPrototypesAdderSketchWithStruct (t * testing.T ) {
@@ -309,7 +322,8 @@ func TestPrototypesAdderSketchWithStruct(t *testing.T) {
309
322
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
310
323
311
324
preprocessed := LoadAndInterpolate (t , filepath .Join ("SketchWithStruct" , "SketchWithStruct.preprocessed.txt" ), ctx )
312
- obtained := strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 )
325
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
326
+ obtained := strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 )
313
327
// ctags based preprocessing removes the space after "dostuff", but this is still OK
314
328
// TODO: remove this exception when moving to a more powerful parser
315
329
preprocessed = strings .Replace (preprocessed , "void dostuff (A_NEW_TYPE * bar);" , "void dostuff(A_NEW_TYPE * bar);" , 1 )
@@ -351,11 +365,12 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
351
365
}
352
366
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
353
367
354
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
355
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 13 " + quotedSketchLocation + "\n void setup();\n #line 17 " + quotedSketchLocation + "\n void loop();\n #line 13 " + quotedSketchLocation + "\n " )
368
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
369
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
370
+ require .Contains (t , preprocessedSketch , "#line 13 " + quotedSketchLocation + "\n void setup();\n #line 17 " + quotedSketchLocation + "\n void loop();\n #line 13 " + quotedSketchLocation + "\n " )
356
371
357
372
preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch_with_config" , "sketch_with_config.preprocessed.txt" ), ctx )
358
- require .Equal (t , preprocessed , strings .Replace (ctx . SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
373
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
359
374
}
360
375
361
376
func TestPrototypesAdderSketchNoFunctionsTwoFiles (t * testing.T ) {
@@ -392,8 +407,9 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
392
407
}
393
408
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
394
409
395
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
396
- require .Equal (t , ctx .SketchSourceMerged , ctx .SketchSourceAfterArduinoPreprocessing ) // No prototypes added
410
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
411
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
412
+ require .Equal (t , ctx .SketchSourceMerged , preprocessedSketch ) // No prototypes added
397
413
}
398
414
399
415
func TestPrototypesAdderSketchNoFunctions (t * testing.T ) {
@@ -430,8 +446,9 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
430
446
}
431
447
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
432
448
433
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
434
- require .Equal (t , ctx .SketchSourceMerged , ctx .SketchSourceAfterArduinoPreprocessing ) // No prototypes added
449
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
450
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
451
+ require .Equal (t , ctx .SketchSourceMerged , preprocessedSketch ) // No prototypes added
435
452
}
436
453
437
454
func TestPrototypesAdderSketchWithDefaultArgs (t * testing.T ) {
@@ -468,8 +485,9 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
468
485
}
469
486
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
470
487
471
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
472
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 4 " + quotedSketchLocation + "\n void setup();\n #line 7 " + quotedSketchLocation + "\n void loop();\n #line 1 " + quotedSketchLocation + "\n " )
488
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
489
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
490
+ require .Contains (t , preprocessedSketch , "#line 4 " + quotedSketchLocation + "\n void setup();\n #line 7 " + quotedSketchLocation + "\n void loop();\n #line 1 " + quotedSketchLocation + "\n " )
473
491
}
474
492
475
493
func TestPrototypesAdderSketchWithInlineFunction (t * testing.T ) {
@@ -506,10 +524,11 @@ func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
506
524
}
507
525
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
508
526
509
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
527
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
528
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
510
529
511
530
expected := "#line 1 " + quotedSketchLocation + "\n void setup();\n #line 2 " + quotedSketchLocation + "\n void loop();\n #line 4 " + quotedSketchLocation + "\n short unsigned int testInt();\n #line 8 " + quotedSketchLocation + "\n static int8_t testInline();\n #line 12 " + quotedSketchLocation + "\n __attribute__((always_inline)) uint8_t testAttribute();\n #line 1 " + quotedSketchLocation + "\n "
512
- obtained := ctx . SketchSourceAfterArduinoPreprocessing
531
+ obtained := preprocessedSketch
513
532
// ctags based preprocessing removes "inline" but this is still OK
514
533
// TODO: remove this exception when moving to a more powerful parser
515
534
expected = strings .Replace (expected , "static inline int8_t testInline();" , "static int8_t testInline();" , - 1 )
@@ -555,8 +574,9 @@ func TestPrototypesAdderSketchWithFunctionSignatureInsideIFDEF(t *testing.T) {
555
574
}
556
575
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
557
576
558
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
559
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 1 " + quotedSketchLocation + "\n void setup();\n #line 3 " + quotedSketchLocation + "\n void loop();\n #line 15 " + quotedSketchLocation + "\n int8_t adalight();\n #line 1 " + quotedSketchLocation + "\n " )
577
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
578
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
579
+ require .Contains (t , preprocessedSketch , "#line 1 " + quotedSketchLocation + "\n void setup();\n #line 3 " + quotedSketchLocation + "\n void loop();\n #line 15 " + quotedSketchLocation + "\n int8_t adalight();\n #line 1 " + quotedSketchLocation + "\n " )
560
580
}
561
581
562
582
func TestPrototypesAdderSketchWithUSBCON (t * testing.T ) {
@@ -593,8 +613,9 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
593
613
}
594
614
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
595
615
596
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
597
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 5 " + quotedSketchLocation + "\n void ciao();\n #line 10 " + quotedSketchLocation + "\n void setup();\n #line 15 " + quotedSketchLocation + "\n void loop();\n #line 5 " + quotedSketchLocation + "\n " )
616
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
617
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
618
+ require .Contains (t , preprocessedSketch , "#line 5 " + quotedSketchLocation + "\n void ciao();\n #line 10 " + quotedSketchLocation + "\n void setup();\n #line 15 " + quotedSketchLocation + "\n void loop();\n #line 5 " + quotedSketchLocation + "\n " )
598
619
}
599
620
600
621
func TestPrototypesAdderSketchWithTypename (t * testing.T ) {
@@ -630,9 +651,10 @@ func TestPrototypesAdderSketchWithTypename(t *testing.T) {
630
651
}
631
652
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
632
653
633
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
654
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
655
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
634
656
expected := "#line 6 " + quotedSketchLocation + "\n void setup();\n #line 10 " + quotedSketchLocation + "\n void loop();\n #line 12 " + quotedSketchLocation + "\n typename Foo<char>::Bar func();\n #line 6 " + quotedSketchLocation + "\n "
635
- obtained := ctx . SketchSourceAfterArduinoPreprocessing
657
+ obtained := preprocessedSketch
636
658
// ctags based preprocessing ignores line with typename
637
659
// TODO: remove this exception when moving to a more powerful parser
638
660
expected = strings .Replace (expected , "#line 12 " + quotedSketchLocation + "\n typename Foo<char>::Bar func();\n " , "" , - 1 )
@@ -674,11 +696,12 @@ func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
674
696
}
675
697
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
676
698
677
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
678
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 5 " + quotedSketchLocation + "\n void elseBranch();\n #line 9 " + quotedSketchLocation + "\n void f1();\n #line 10 " + quotedSketchLocation + "\n void f2();\n #line 12 " + quotedSketchLocation + "\n void setup();\n #line 14 " + quotedSketchLocation + "\n void loop();\n #line 5 " + quotedSketchLocation + "\n " )
699
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
700
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
701
+ require .Contains (t , preprocessedSketch , "#line 5 " + quotedSketchLocation + "\n void elseBranch();\n #line 9 " + quotedSketchLocation + "\n void f1();\n #line 10 " + quotedSketchLocation + "\n void f2();\n #line 12 " + quotedSketchLocation + "\n void setup();\n #line 14 " + quotedSketchLocation + "\n void loop();\n #line 5 " + quotedSketchLocation + "\n " )
679
702
680
703
expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.txt" ), ctx )
681
- require .Equal (t , expectedSource , strings .Replace (ctx . SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
704
+ require .Equal (t , expectedSource , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
682
705
}
683
706
684
707
func TestPrototypesAdderSketchWithIfDef2SAM (t * testing.T ) {
@@ -715,11 +738,12 @@ func TestPrototypesAdderSketchWithIfDef2SAM(t *testing.T) {
715
738
}
716
739
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
717
740
718
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
719
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 2 " + quotedSketchLocation + "\n void ifBranch();\n #line 9 " + quotedSketchLocation + "\n void f1();\n #line 10 " + quotedSketchLocation + "\n void f2();\n #line 12 " + quotedSketchLocation + "\n void setup();\n #line 14 " + quotedSketchLocation + "\n void loop();\n #line 2 " + quotedSketchLocation + "\n " )
741
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
742
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
743
+ require .Contains (t , preprocessedSketch , "#line 2 " + quotedSketchLocation + "\n void ifBranch();\n #line 9 " + quotedSketchLocation + "\n void f1();\n #line 10 " + quotedSketchLocation + "\n void f2();\n #line 12 " + quotedSketchLocation + "\n void setup();\n #line 14 " + quotedSketchLocation + "\n void loop();\n #line 2 " + quotedSketchLocation + "\n " )
720
744
721
745
expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.SAM.txt" ), ctx )
722
- require .Equal (t , expectedSource , strings .Replace (ctx . SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
746
+ require .Equal (t , expectedSource , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
723
747
}
724
748
725
749
func TestPrototypesAdderSketchWithConst (t * testing.T ) {
@@ -756,8 +780,9 @@ func TestPrototypesAdderSketchWithConst(t *testing.T) {
756
780
}
757
781
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
758
782
759
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
760
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 1 " + quotedSketchLocation + "\n void setup();\n #line 2 " + quotedSketchLocation + "\n void loop();\n #line 4 " + quotedSketchLocation + "\n const __FlashStringHelper* test();\n #line 6 " + quotedSketchLocation + "\n const int test3();\n #line 8 " + quotedSketchLocation + "\n volatile __FlashStringHelper* test2();\n #line 10 " + quotedSketchLocation + "\n volatile int test4();\n #line 1 " + quotedSketchLocation + "\n " )
783
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
784
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
785
+ require .Contains (t , preprocessedSketch , "#line 1 " + quotedSketchLocation + "\n void setup();\n #line 2 " + quotedSketchLocation + "\n void loop();\n #line 4 " + quotedSketchLocation + "\n const __FlashStringHelper* test();\n #line 6 " + quotedSketchLocation + "\n const int test3();\n #line 8 " + quotedSketchLocation + "\n volatile __FlashStringHelper* test2();\n #line 10 " + quotedSketchLocation + "\n volatile int test4();\n #line 1 " + quotedSketchLocation + "\n " )
761
786
}
762
787
763
788
func TestPrototypesAdderSketchWithDosEol (t * testing.T ) {
@@ -826,5 +851,6 @@ func TestPrototypesAdderSketchWithSubstringFunctionMember(t *testing.T) {
826
851
}
827
852
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
828
853
829
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "class Foo {\n int blooper(int x) { return x+1; }\n };\n \n Foo foo;\n \n #line 7 " + quotedSketchLocation + "\n void setup();" )
854
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
855
+ require .Contains (t , preprocessedSketch , "class Foo {\n int blooper(int x) { return x+1; }\n };\n \n Foo foo;\n \n #line 7 " + quotedSketchLocation + "\n void setup();" )
830
856
}
0 commit comments