@@ -83,7 +83,7 @@ func TestPrototypesAdderBridgeExample(t *testing.T) {
8383 NoError (t , err )
8484 }
8585
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 " )
8787 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 )
8888}
8989
@@ -411,7 +411,7 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
411411 NoError (t , err )
412412 }
413413
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 " )
415415 require .Equal (t , "#line 13 " + quotedSketchLocation + "\n void setup();\n #line 17 " + quotedSketchLocation + "\n void loop();\n #line 13 " + quotedSketchLocation + "\n " , ctx .PrototypesSection )
416416
417417 preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch_with_config" , "sketch_with_config.preprocessed.txt" ), ctx )
@@ -457,7 +457,7 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
457457 NoError (t , err )
458458 }
459459
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 " )
461461 require .Equal (t , "" , ctx .PrototypesSection )
462462}
463463
@@ -500,7 +500,7 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
500500 NoError (t , err )
501501 }
502502
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 " )
504504 require .Equal (t , "" , ctx .PrototypesSection )
505505}
506506
@@ -543,7 +543,7 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
543543 NoError (t , err )
544544 }
545545
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 " )
547547 require .Equal (t , "#line 4 " + quotedSketchLocation + "\n void setup();\n #line 7 " + quotedSketchLocation + "\n void loop();\n #line 1 " + quotedSketchLocation + "\n " , ctx .PrototypesSection )
548548}
549549
@@ -586,7 +586,7 @@ func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
586586 NoError (t , err )
587587 }
588588
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 " )
590590
591591 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 "
592592 obtained := ctx .PrototypesSection
@@ -640,7 +640,7 @@ func TestPrototypesAdderSketchWithFunctionSignatureInsideIFDEF(t *testing.T) {
640640 NoError (t , err )
641641 }
642642
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 " )
644644 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 )
645645}
646646
@@ -683,7 +683,7 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
683683 NoError (t , err )
684684 }
685685
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 " )
687687 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 )
688688}
689689
@@ -725,7 +725,7 @@ func TestPrototypesAdderSketchWithTypename(t *testing.T) {
725725 NoError (t , err )
726726 }
727727
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 " )
729729 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 "
730730 obtained := ctx .PrototypesSection
731731 // ctags based preprocessing ignores line with typename
@@ -774,7 +774,7 @@ func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
774774 NoError (t , err )
775775 }
776776
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 " )
778778 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 )
779779
780780 expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.txt" ), ctx )
@@ -820,7 +820,7 @@ func TestPrototypesAdderSketchWithIfDef2SAM(t *testing.T) {
820820 NoError (t , err )
821821 }
822822
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 " )
824824 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 )
825825
826826 expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.SAM.txt" ), ctx )
@@ -866,7 +866,7 @@ func TestPrototypesAdderSketchWithConst(t *testing.T) {
866866 NoError (t , err )
867867 }
868868
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 " )
870870 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 )
871871}
872872
0 commit comments