@@ -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
sketchLocation := paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" )
34
40
quotedSketchLocation := cpp .QuoteString (Abs (t , sketchLocation ).String ())
@@ -53,8 +59,9 @@ func TestPrototypesAdderBridgeExample(t *testing.T) {
53
59
}
54
60
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
55
61
56
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
57
- 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 " )
62
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
63
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
64
+ 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 " )
58
65
}
59
66
60
67
func TestPrototypesAdderSketchWithIfDef (t * testing.T ) {
@@ -79,7 +86,8 @@ func TestPrototypesAdderSketchWithIfDef(t *testing.T) {
79
86
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
80
87
81
88
preprocessed := LoadAndInterpolate (t , filepath .Join ("SketchWithIfDef" , "SketchWithIfDef.preprocessed.txt" ), ctx )
82
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
89
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
90
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
83
91
}
84
92
85
93
func TestPrototypesAdderBaladuino (t * testing.T ) {
@@ -104,7 +112,8 @@ func TestPrototypesAdderBaladuino(t *testing.T) {
104
112
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
105
113
106
114
preprocessed := LoadAndInterpolate (t , filepath .Join ("Baladuino" , "Baladuino.preprocessed.txt" ), ctx )
107
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
115
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
116
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
108
117
}
109
118
110
119
func TestPrototypesAdderCharWithEscapedDoubleQuote (t * testing.T ) {
@@ -129,7 +138,8 @@ func TestPrototypesAdderCharWithEscapedDoubleQuote(t *testing.T) {
129
138
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
130
139
131
140
preprocessed := LoadAndInterpolate (t , filepath .Join ("CharWithEscapedDoubleQuote" , "CharWithEscapedDoubleQuote.preprocessed.txt" ), ctx )
132
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
141
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
142
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
133
143
}
134
144
135
145
func TestPrototypesAdderIncludeBetweenMultilineComment (t * testing.T ) {
@@ -154,7 +164,8 @@ func TestPrototypesAdderIncludeBetweenMultilineComment(t *testing.T) {
154
164
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
155
165
156
166
preprocessed := LoadAndInterpolate (t , filepath .Join ("IncludeBetweenMultilineComment" , "IncludeBetweenMultilineComment.preprocessed.txt" ), ctx )
157
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
167
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
168
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
158
169
}
159
170
160
171
func TestPrototypesAdderLineContinuations (t * testing.T ) {
@@ -179,7 +190,8 @@ func TestPrototypesAdderLineContinuations(t *testing.T) {
179
190
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
180
191
181
192
preprocessed := LoadAndInterpolate (t , filepath .Join ("LineContinuations" , "LineContinuations.preprocessed.txt" ), ctx )
182
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
193
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
194
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
183
195
}
184
196
185
197
func TestPrototypesAdderStringWithComment (t * testing.T ) {
@@ -204,7 +216,8 @@ func TestPrototypesAdderStringWithComment(t *testing.T) {
204
216
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
205
217
206
218
preprocessed := LoadAndInterpolate (t , filepath .Join ("StringWithComment" , "StringWithComment.preprocessed.txt" ), ctx )
207
- require .Equal (t , preprocessed , strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
219
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
220
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
208
221
}
209
222
210
223
func TestPrototypesAdderSketchWithStruct (t * testing.T ) {
@@ -229,7 +242,8 @@ func TestPrototypesAdderSketchWithStruct(t *testing.T) {
229
242
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
230
243
231
244
preprocessed := LoadAndInterpolate (t , filepath .Join ("SketchWithStruct" , "SketchWithStruct.preprocessed.txt" ), ctx )
232
- obtained := strings .Replace (ctx .SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 )
245
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
246
+ obtained := strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 )
233
247
// ctags based preprocessing removes the space after "dostuff", but this is still OK
234
248
// TODO: remove this exception when moving to a more powerful parser
235
249
preprocessed = strings .Replace (preprocessed , "void dostuff (A_NEW_TYPE * bar);" , "void dostuff(A_NEW_TYPE * bar);" , 1 )
@@ -261,11 +275,12 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
261
275
}
262
276
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
263
277
264
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
265
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 13 " + quotedSketchLocation + "\n void setup();\n #line 17 " + quotedSketchLocation + "\n void loop();\n #line 13 " + quotedSketchLocation + "\n " )
278
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
279
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
280
+ require .Contains (t , preprocessedSketch , "#line 13 " + quotedSketchLocation + "\n void setup();\n #line 17 " + quotedSketchLocation + "\n void loop();\n #line 13 " + quotedSketchLocation + "\n " )
266
281
267
282
preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch_with_config" , "sketch_with_config.preprocessed.txt" ), ctx )
268
- require .Equal (t , preprocessed , strings .Replace (ctx . SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
283
+ require .Equal (t , preprocessed , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
269
284
}
270
285
271
286
func TestPrototypesAdderSketchNoFunctionsTwoFiles (t * testing.T ) {
@@ -292,8 +307,9 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
292
307
}
293
308
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
294
309
295
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
296
- require .Equal (t , ctx .SketchSourceMerged , ctx .SketchSourceAfterArduinoPreprocessing ) // No prototypes added
310
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
311
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
312
+ require .Equal (t , ctx .SketchSourceMerged , preprocessedSketch ) // No prototypes added
297
313
}
298
314
299
315
func TestPrototypesAdderSketchNoFunctions (t * testing.T ) {
@@ -319,8 +335,9 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
319
335
}
320
336
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
321
337
322
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
323
- require .Equal (t , ctx .SketchSourceMerged , ctx .SketchSourceAfterArduinoPreprocessing ) // No prototypes added
338
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
339
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
340
+ require .Equal (t , ctx .SketchSourceMerged , preprocessedSketch ) // No prototypes added
324
341
}
325
342
326
343
func TestPrototypesAdderSketchWithDefaultArgs (t * testing.T ) {
@@ -347,8 +364,9 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
347
364
}
348
365
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
349
366
350
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
351
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#line 4 " + quotedSketchLocation + "\n void setup();\n #line 7 " + quotedSketchLocation + "\n void loop();\n #line 1 " + quotedSketchLocation + "\n " )
367
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
368
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
369
+ require .Contains (t , preprocessedSketch , "#line 4 " + quotedSketchLocation + "\n void setup();\n #line 7 " + quotedSketchLocation + "\n void loop();\n #line 1 " + quotedSketchLocation + "\n " )
352
370
}
353
371
354
372
func TestPrototypesAdderSketchWithInlineFunction (t * testing.T ) {
@@ -375,10 +393,11 @@ func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
375
393
}
376
394
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
377
395
378
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
396
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
397
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
379
398
380
399
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 "
381
- obtained := ctx . SketchSourceAfterArduinoPreprocessing
400
+ obtained := preprocessedSketch
382
401
// ctags based preprocessing removes "inline" but this is still OK
383
402
// TODO: remove this exception when moving to a more powerful parser
384
403
expected = strings .Replace (expected , "static inline int8_t testInline();" , "static int8_t testInline();" , - 1 )
@@ -414,8 +433,9 @@ func TestPrototypesAdderSketchWithFunctionSignatureInsideIFDEF(t *testing.T) {
414
433
}
415
434
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
416
435
417
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
418
- 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 " )
436
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
437
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
438
+ 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 " )
419
439
}
420
440
421
441
func TestPrototypesAdderSketchWithUSBCON (t * testing.T ) {
@@ -447,8 +467,9 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
447
467
}
448
468
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
449
469
450
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
451
- 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 " )
470
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
471
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
472
+ 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 " )
452
473
}
453
474
454
475
func TestPrototypesAdderSketchWithTypename (t * testing.T ) {
@@ -479,9 +500,10 @@ func TestPrototypesAdderSketchWithTypename(t *testing.T) {
479
500
}
480
501
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
481
502
482
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
503
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
504
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
483
505
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 "
484
- obtained := ctx . SketchSourceAfterArduinoPreprocessing
506
+ obtained := preprocessedSketch
485
507
// ctags based preprocessing ignores line with typename
486
508
// TODO: remove this exception when moving to a more powerful parser
487
509
expected = strings .Replace (expected , "#line 12 " + quotedSketchLocation + "\n typename Foo<char>::Bar func();\n " , "" , - 1 )
@@ -513,11 +535,12 @@ func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
513
535
}
514
536
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
515
537
516
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
517
- 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 " )
538
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
539
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
540
+ 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 " )
518
541
519
542
expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.txt" ), ctx )
520
- require .Equal (t , expectedSource , strings .Replace (ctx . SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
543
+ require .Equal (t , expectedSource , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
521
544
}
522
545
523
546
func TestPrototypesAdderSketchWithIfDef2SAM (t * testing.T ) {
@@ -544,11 +567,12 @@ func TestPrototypesAdderSketchWithIfDef2SAM(t *testing.T) {
544
567
}
545
568
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
546
569
547
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
548
- 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 " )
570
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
571
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
572
+ 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 " )
549
573
550
574
expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.SAM.txt" ), ctx )
551
- require .Equal (t , expectedSource , strings .Replace (ctx . SketchSourceAfterArduinoPreprocessing , "\r \n " , "\n " , - 1 ))
575
+ require .Equal (t , expectedSource , strings .Replace (preprocessedSketch , "\r \n " , "\n " , - 1 ))
552
576
}
553
577
554
578
func TestPrototypesAdderSketchWithConst (t * testing.T ) {
@@ -575,8 +599,9 @@ func TestPrototypesAdderSketchWithConst(t *testing.T) {
575
599
}
576
600
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
577
601
578
- require .Contains (t , ctx .SketchSourceAfterArduinoPreprocessing , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
579
- 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 " )
602
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
603
+ require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
604
+ 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 " )
580
605
}
581
606
582
607
func TestPrototypesAdderSketchWithDosEol (t * testing.T ) {
@@ -626,5 +651,6 @@ func TestPrototypesAdderSketchWithSubstringFunctionMember(t *testing.T) {
626
651
}
627
652
NoError (t , builder .PreprocessSketchWithCtags (ctx ))
628
653
629
- 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();" )
654
+ preprocessedSketch := loadPreprocessedSketch (t , ctx )
655
+ 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();" )
630
656
}
0 commit comments