@@ -83,7 +83,7 @@ func TestPrototypesAdderBridgeExample(t *testing.T) {
83
83
NoError (t , err )
84
84
}
85
85
86
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
86
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
87
87
require .Equal (t , "#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 " , ctx .PrototypesSection )
88
88
}
89
89
@@ -411,7 +411,7 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
411
411
NoError (t , err )
412
412
}
413
413
414
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
414
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
415
415
require .Equal (t , "#line 13 " + quotedSketchLocation + "\n void setup();\n #line 17 " + quotedSketchLocation + "\n void loop();\n #line 13 " + quotedSketchLocation + "\n " , ctx .PrototypesSection )
416
416
417
417
preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch_with_config" , "sketch_with_config.preprocessed.txt" ), ctx )
@@ -457,7 +457,7 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
457
457
NoError (t , err )
458
458
}
459
459
460
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
460
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
461
461
require .Equal (t , "" , ctx .PrototypesSection )
462
462
}
463
463
@@ -500,7 +500,7 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
500
500
NoError (t , err )
501
501
}
502
502
503
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
503
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
504
504
require .Equal (t , "" , ctx .PrototypesSection )
505
505
}
506
506
@@ -543,7 +543,7 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
543
543
NoError (t , err )
544
544
}
545
545
546
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
546
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
547
547
require .Equal (t , "#line 4 " + quotedSketchLocation + "\n void setup();\n #line 7 " + quotedSketchLocation + "\n void loop();\n #line 1 " + quotedSketchLocation + "\n " , ctx .PrototypesSection )
548
548
}
549
549
@@ -586,7 +586,7 @@ func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
586
586
NoError (t , err )
587
587
}
588
588
589
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
589
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
590
590
591
591
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 "
592
592
obtained := ctx .PrototypesSection
@@ -640,7 +640,7 @@ func TestPrototypesAdderSketchWithFunctionSignatureInsideIFDEF(t *testing.T) {
640
640
NoError (t , err )
641
641
}
642
642
643
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
643
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
644
644
require .Equal (t , "#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 " , ctx .PrototypesSection )
645
645
}
646
646
@@ -683,7 +683,7 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
683
683
NoError (t , err )
684
684
}
685
685
686
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
686
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
687
687
require .Equal (t , "#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 " , ctx .PrototypesSection )
688
688
}
689
689
@@ -725,7 +725,7 @@ func TestPrototypesAdderSketchWithTypename(t *testing.T) {
725
725
NoError (t , err )
726
726
}
727
727
728
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
728
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
729
729
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 "
730
730
obtained := ctx .PrototypesSection
731
731
// ctags based preprocessing ignores line with typename
@@ -774,7 +774,7 @@ func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
774
774
NoError (t , err )
775
775
}
776
776
777
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
777
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
778
778
require .Equal (t , "#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 " , ctx .PrototypesSection )
779
779
780
780
expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.txt" ), ctx )
@@ -820,7 +820,7 @@ func TestPrototypesAdderSketchWithIfDef2SAM(t *testing.T) {
820
820
NoError (t , err )
821
821
}
822
822
823
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
823
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
824
824
require .Equal (t , "#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 " , ctx .PrototypesSection )
825
825
826
826
expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.SAM.txt" ), ctx )
@@ -866,7 +866,7 @@ func TestPrototypesAdderSketchWithConst(t *testing.T) {
866
866
NoError (t , err )
867
867
}
868
868
869
- require .Equal (t , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " , ctx . IncludeSection )
869
+ require .Contains (t , ctx . Source , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
870
870
require .Equal (t , "#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 " , ctx .PrototypesSection )
871
871
}
872
872
0 commit comments