@@ -124,7 +124,7 @@ func TestPrototypesAdderSketchWithIfDef(t *testing.T) {
124
124
NoError (t , err )
125
125
}
126
126
127
- preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch2" , "SketchWithIfDef.preprocessed.txt" ), context )
127
+ preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch2" , "SketchWithIfDef.preprocessed.txt" ), context , ctx )
128
128
require .Equal (t , preprocessed , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
129
129
}
130
130
@@ -165,7 +165,7 @@ func TestPrototypesAdderBaladuino(t *testing.T) {
165
165
NoError (t , err )
166
166
}
167
167
168
- preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch3" , "Baladuino.preprocessed.txt" ), context )
168
+ preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch3" , "Baladuino.preprocessed.txt" ), context , ctx )
169
169
require .Equal (t , preprocessed , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
170
170
}
171
171
@@ -206,7 +206,7 @@ func TestPrototypesAdderCharWithEscapedDoubleQuote(t *testing.T) {
206
206
NoError (t , err )
207
207
}
208
208
209
- preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch4" , "CharWithEscapedDoubleQuote.preprocessed.txt" ), context )
209
+ preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch4" , "CharWithEscapedDoubleQuote.preprocessed.txt" ), context , ctx )
210
210
require .Equal (t , preprocessed , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
211
211
}
212
212
@@ -247,7 +247,7 @@ func TestPrototypesAdderIncludeBetweenMultilineComment(t *testing.T) {
247
247
NoError (t , err )
248
248
}
249
249
250
- preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch5" , "IncludeBetweenMultilineComment.preprocessed.txt" ), context )
250
+ preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch5" , "IncludeBetweenMultilineComment.preprocessed.txt" ), context , ctx )
251
251
require .Equal (t , preprocessed , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
252
252
}
253
253
@@ -288,7 +288,7 @@ func TestPrototypesAdderLineContinuations(t *testing.T) {
288
288
NoError (t , err )
289
289
}
290
290
291
- preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch6" , "LineContinuations.preprocessed.txt" ), context )
291
+ preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch6" , "LineContinuations.preprocessed.txt" ), context , ctx )
292
292
require .Equal (t , preprocessed , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
293
293
}
294
294
@@ -329,7 +329,7 @@ func TestPrototypesAdderStringWithComment(t *testing.T) {
329
329
NoError (t , err )
330
330
}
331
331
332
- preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch7" , "StringWithComment.preprocessed.txt" ), context )
332
+ preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch7" , "StringWithComment.preprocessed.txt" ), context , ctx )
333
333
require .Equal (t , preprocessed , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
334
334
}
335
335
@@ -370,7 +370,7 @@ func TestPrototypesAdderSketchWithStruct(t *testing.T) {
370
370
NoError (t , err )
371
371
}
372
372
373
- preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch8" , "SketchWithStruct.preprocessed.txt" ), context )
373
+ preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch8" , "SketchWithStruct.preprocessed.txt" ), context , ctx )
374
374
obtained := strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 )
375
375
// ctags based preprocessing removes the space after "dostuff", but this is still OK
376
376
// TODO: remove this exception when moving to a more powerful parser
@@ -422,7 +422,7 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
422
422
require .Equal (t , "#include <Arduino.h>\n #line 1 \" " + absoluteSketchLocation + "\" \n " , context [constants .CTX_INCLUDE_SECTION ].(string ))
423
423
require .Equal (t , "#line 13 \" " + absoluteSketchLocation + "\" \n void setup();\n #line 17 \" " + absoluteSketchLocation + "\" \n void loop();\n #line 13 \" " + absoluteSketchLocation + "\" \n " , ctx .PrototypesSection )
424
424
425
- preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch_with_config" , "sketch_with_config.preprocessed.txt" ), context )
425
+ preprocessed := LoadAndInterpolate (t , filepath .Join ("sketch_with_config" , "sketch_with_config.preprocessed.txt" ), context , ctx )
426
426
require .Equal (t , preprocessed , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
427
427
}
428
428
@@ -793,7 +793,7 @@ func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
793
793
require .Equal (t , "#include <Arduino.h>\n #line 1 \" " + absoluteSketchLocation + "\" \n " , context [constants .CTX_INCLUDE_SECTION ].(string ))
794
794
require .Equal (t , "#line 5 \" " + absoluteSketchLocation + "\" \n void elseBranch();\n #line 9 \" " + absoluteSketchLocation + "\" \n void f1();\n #line 10 \" " + absoluteSketchLocation + "\" \n void f2();\n #line 12 \" " + absoluteSketchLocation + "\" \n void setup();\n #line 14 \" " + absoluteSketchLocation + "\" \n void loop();\n #line 5 \" " + absoluteSketchLocation + "\" \n " , ctx .PrototypesSection )
795
795
796
- expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.txt" ), context )
796
+ expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.txt" ), context , ctx )
797
797
require .Equal (t , expectedSource , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
798
798
}
799
799
@@ -840,7 +840,7 @@ func TestPrototypesAdderSketchWithIfDef2SAM(t *testing.T) {
840
840
require .Equal (t , "#include <Arduino.h>\n #line 1 \" " + absoluteSketchLocation + "\" \n " , context [constants .CTX_INCLUDE_SECTION ].(string ))
841
841
require .Equal (t , "#line 2 \" " + absoluteSketchLocation + "\" \n void ifBranch();\n #line 9 \" " + absoluteSketchLocation + "\" \n void f1();\n #line 10 \" " + absoluteSketchLocation + "\" \n void f2();\n #line 12 \" " + absoluteSketchLocation + "\" \n void setup();\n #line 14 \" " + absoluteSketchLocation + "\" \n void loop();\n #line 2 \" " + absoluteSketchLocation + "\" \n " , ctx .PrototypesSection )
842
842
843
- expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.SAM.txt" ), context )
843
+ expectedSource := LoadAndInterpolate (t , filepath .Join ("sketch_with_ifdef" , "sketch.preprocessed.SAM.txt" ), context , ctx )
844
844
require .Equal (t , expectedSource , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
845
845
}
846
846
0 commit comments