@@ -48,7 +48,7 @@ func TestPrototypesAdderBridgeExample(t *testing.T) {
4848 commands := []types.Command {
4949 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
5050 types .BareCommand (func (ctx * types.Context ) error {
51- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
51+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
5252 return _err
5353 }),
5454 & builder.ContainerFindIncludes {},
@@ -74,7 +74,7 @@ func TestPrototypesAdderSketchWithIfDef(t *testing.T) {
7474 commands := []types.Command {
7575 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
7676 types .BareCommand (func (ctx * types.Context ) error {
77- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
77+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
7878 return _err
7979 }),
8080 & builder.ContainerFindIncludes {},
@@ -100,7 +100,7 @@ func TestPrototypesAdderBaladuino(t *testing.T) {
100100 commands := []types.Command {
101101 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
102102 types .BareCommand (func (ctx * types.Context ) error {
103- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
103+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
104104 return _err
105105 }),
106106 & builder.ContainerFindIncludes {},
@@ -126,7 +126,7 @@ func TestPrototypesAdderCharWithEscapedDoubleQuote(t *testing.T) {
126126 commands := []types.Command {
127127 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
128128 types .BareCommand (func (ctx * types.Context ) error {
129- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
129+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
130130 return _err
131131 }),
132132 & builder.ContainerFindIncludes {},
@@ -152,7 +152,7 @@ func TestPrototypesAdderIncludeBetweenMultilineComment(t *testing.T) {
152152 commands := []types.Command {
153153 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
154154 types .BareCommand (func (ctx * types.Context ) error {
155- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
155+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
156156 return _err
157157 }),
158158 & builder.ContainerFindIncludes {},
@@ -178,7 +178,7 @@ func TestPrototypesAdderLineContinuations(t *testing.T) {
178178 commands := []types.Command {
179179 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
180180 types .BareCommand (func (ctx * types.Context ) error {
181- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
181+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
182182 return _err
183183 }),
184184 & builder.ContainerFindIncludes {},
@@ -204,7 +204,7 @@ func TestPrototypesAdderStringWithComment(t *testing.T) {
204204 commands := []types.Command {
205205 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
206206 types .BareCommand (func (ctx * types.Context ) error {
207- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
207+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
208208 return _err
209209 }),
210210 & builder.ContainerFindIncludes {},
@@ -230,7 +230,7 @@ func TestPrototypesAdderSketchWithStruct(t *testing.T) {
230230 commands := []types.Command {
231231 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
232232 types .BareCommand (func (ctx * types.Context ) error {
233- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
233+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
234234 return _err
235235 }),
236236 & builder.ContainerFindIncludes {},
@@ -264,7 +264,7 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
264264 commands := []types.Command {
265265 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
266266 types .BareCommand (func (ctx * types.Context ) error {
267- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
267+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
268268 return _err
269269 }),
270270 & builder.ContainerFindIncludes {},
@@ -296,7 +296,7 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
296296 commands := []types.Command {
297297 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
298298 types .BareCommand (func (ctx * types.Context ) error {
299- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
299+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
300300 return _err
301301 }),
302302 & builder.ContainerFindIncludes {},
@@ -305,11 +305,12 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
305305 err := command .Run (ctx )
306306 NoError (t , err )
307307 }
308+ mergedSketch := loadPreprocessedSketch (t , ctx )
308309 NoError (t , builder .PreprocessSketchWithCtags (ctx ))
309310
310311 preprocessedSketch := loadPreprocessedSketch (t , ctx )
311312 require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
312- require .Equal (t , ctx . SketchSourceMerged , preprocessedSketch ) // No prototypes added
313+ require .Equal (t , mergedSketch , preprocessedSketch ) // No prototypes added
313314}
314315
315316func TestPrototypesAdderSketchNoFunctions (t * testing.T ) {
@@ -324,7 +325,7 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
324325 commands := []types.Command {
325326 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
326327 types .BareCommand (func (ctx * types.Context ) error {
327- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
328+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
328329 return _err
329330 }),
330331 & builder.ContainerFindIncludes {},
@@ -333,11 +334,12 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
333334 err := command .Run (ctx )
334335 NoError (t , err )
335336 }
337+ mergedSketch := loadPreprocessedSketch (t , ctx )
336338 NoError (t , builder .PreprocessSketchWithCtags (ctx ))
337339
338340 preprocessedSketch := loadPreprocessedSketch (t , ctx )
339341 require .Contains (t , preprocessedSketch , "#include <Arduino.h>\n #line 1 " + quotedSketchLocation + "\n " )
340- require .Equal (t , ctx . SketchSourceMerged , preprocessedSketch ) // No prototypes added
342+ require .Equal (t , mergedSketch , preprocessedSketch ) // No prototypes added
341343}
342344
343345func TestPrototypesAdderSketchWithDefaultArgs (t * testing.T ) {
@@ -353,7 +355,7 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
353355 commands := []types.Command {
354356 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
355357 types .BareCommand (func (ctx * types.Context ) error {
356- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
358+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
357359 return _err
358360 }),
359361 & builder.ContainerFindIncludes {},
@@ -382,7 +384,7 @@ func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
382384 commands := []types.Command {
383385 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
384386 types .BareCommand (func (ctx * types.Context ) error {
385- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
387+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
386388 return _err
387389 }),
388390 & builder.ContainerFindIncludes {},
@@ -422,7 +424,7 @@ func TestPrototypesAdderSketchWithFunctionSignatureInsideIFDEF(t *testing.T) {
422424 commands := []types.Command {
423425 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
424426 types .BareCommand (func (ctx * types.Context ) error {
425- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
427+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
426428 return _err
427429 }),
428430 & builder.ContainerFindIncludes {},
@@ -456,7 +458,7 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
456458 commands := []types.Command {
457459 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
458460 types .BareCommand (func (ctx * types.Context ) error {
459- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
461+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
460462 return _err
461463 }),
462464 & builder.ContainerFindIncludes {},
@@ -489,7 +491,7 @@ func TestPrototypesAdderSketchWithTypename(t *testing.T) {
489491 commands := []types.Command {
490492 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
491493 types .BareCommand (func (ctx * types.Context ) error {
492- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
494+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
493495 return _err
494496 }),
495497 & builder.ContainerFindIncludes {},
@@ -524,7 +526,7 @@ func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
524526 commands := []types.Command {
525527 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
526528 types .BareCommand (func (ctx * types.Context ) error {
527- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
529+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
528530 return _err
529531 }),
530532 & builder.ContainerFindIncludes {},
@@ -556,7 +558,7 @@ func TestPrototypesAdderSketchWithIfDef2SAM(t *testing.T) {
556558 commands := []types.Command {
557559 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
558560 types .BareCommand (func (ctx * types.Context ) error {
559- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
561+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
560562 return _err
561563 }),
562564 & builder.ContainerFindIncludes {},
@@ -588,7 +590,7 @@ func TestPrototypesAdderSketchWithConst(t *testing.T) {
588590 commands := []types.Command {
589591 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
590592 types .BareCommand (func (ctx * types.Context ) error {
591- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
593+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
592594 return _err
593595 }),
594596 & builder.ContainerFindIncludes {},
@@ -614,7 +616,7 @@ func TestPrototypesAdderSketchWithDosEol(t *testing.T) {
614616 commands := []types.Command {
615617 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
616618 types .BareCommand (func (ctx * types.Context ) error {
617- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
619+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
618620 return _err
619621 }),
620622 & builder.ContainerFindIncludes {},
@@ -640,7 +642,7 @@ func TestPrototypesAdderSketchWithSubstringFunctionMember(t *testing.T) {
640642 commands := []types.Command {
641643 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
642644 types .BareCommand (func (ctx * types.Context ) error {
643- ctx .LineOffset , ctx . SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
645+ ctx .LineOffset , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
644646 return _err
645647 }),
646648 & builder.ContainerFindIncludes {},
0 commit comments