@@ -435,3 +435,83 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
435
435
436
436
require .Equal (t , preprocessed , strings .Replace (context [constants .CTX_SOURCE ].(string ), "\r \n " , "\n " , - 1 ))
437
437
}
438
+
439
+ func TestPrototypesAdderSketchNoFunctionsTwoFiles (t * testing.T ) {
440
+ DownloadCoresAndToolsAndLibraries (t )
441
+
442
+ context := make (map [string ]interface {})
443
+
444
+ buildPath := SetupBuildPath (t , context )
445
+ defer os .RemoveAll (buildPath )
446
+
447
+ context [constants .CTX_HARDWARE_FOLDERS ] = []string {filepath .Join (".." , "hardware" ), "hardware" , "downloaded_hardware" }
448
+ context [constants .CTX_TOOLS_FOLDERS ] = []string {"downloaded_tools" }
449
+ context [constants .CTX_FQBN ] = "arduino:avr:leonardo"
450
+ context [constants .CTX_SKETCH_LOCATION ] = filepath .Join ("sketch_no_functions_two_files" , "main.ino" )
451
+ context [constants .CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION ] = "10600"
452
+ context [constants .CTX_LIBRARIES_FOLDERS ] = []string {"libraries" , "downloaded_libraries" }
453
+ context [constants .CTX_VERBOSE ] = true
454
+
455
+ commands := []types.Command {
456
+ & builder.SetupHumanLoggerIfMissing {},
457
+
458
+ & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
459
+
460
+ & builder.ContainerMergeCopySketchFiles {},
461
+
462
+ & builder.ContainerFindIncludes {},
463
+
464
+ & builder.PrintUsedLibrariesIfVerbose {},
465
+ & builder.WarnAboutArchIncompatibleLibraries {},
466
+
467
+ & builder.ContainerAddPrototypes {},
468
+ }
469
+
470
+ for _ , command := range commands {
471
+ err := command .Run (context )
472
+ NoError (t , err )
473
+ }
474
+
475
+ require .Nil (t , context [constants .CTX_INCLUDE_SECTION ])
476
+ require .Nil (t , context [constants .CTX_PROTOTYPE_SECTION ])
477
+ }
478
+
479
+ func TestPrototypesAdderSketchNoFunctions (t * testing.T ) {
480
+ DownloadCoresAndToolsAndLibraries (t )
481
+
482
+ context := make (map [string ]interface {})
483
+
484
+ buildPath := SetupBuildPath (t , context )
485
+ defer os .RemoveAll (buildPath )
486
+
487
+ context [constants .CTX_HARDWARE_FOLDERS ] = []string {filepath .Join (".." , "hardware" ), "hardware" , "downloaded_hardware" }
488
+ context [constants .CTX_TOOLS_FOLDERS ] = []string {"downloaded_tools" }
489
+ context [constants .CTX_FQBN ] = "arduino:avr:leonardo"
490
+ context [constants .CTX_SKETCH_LOCATION ] = filepath .Join ("sketch_no_functions" , "main.ino" )
491
+ context [constants .CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION ] = "10600"
492
+ context [constants .CTX_LIBRARIES_FOLDERS ] = []string {"libraries" , "downloaded_libraries" }
493
+ context [constants .CTX_VERBOSE ] = true
494
+
495
+ commands := []types.Command {
496
+ & builder.SetupHumanLoggerIfMissing {},
497
+
498
+ & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
499
+
500
+ & builder.ContainerMergeCopySketchFiles {},
501
+
502
+ & builder.ContainerFindIncludes {},
503
+
504
+ & builder.PrintUsedLibrariesIfVerbose {},
505
+ & builder.WarnAboutArchIncompatibleLibraries {},
506
+
507
+ & builder.ContainerAddPrototypes {},
508
+ }
509
+
510
+ for _ , command := range commands {
511
+ err := command .Run (context )
512
+ NoError (t , err )
513
+ }
514
+
515
+ require .Nil (t , context [constants .CTX_INCLUDE_SECTION ])
516
+ require .Nil (t , context [constants .CTX_PROTOTYPE_SECTION ])
517
+ }
0 commit comments