@@ -71,3 +71,37 @@ func TestCompileWithOutputDirFlag(t *testing.T) {
71
71
require .FileExists (t , outputDir .Join (sketchName + ".ino.with_bootloader.bin" ).String ())
72
72
require .FileExists (t , outputDir .Join (sketchName + ".ino.with_bootloader.hex" ).String ())
73
73
}
74
+
75
+ func TestCompileWithExportBinariesFlag (t * testing.T ) {
76
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
77
+ defer env .CleanUp ()
78
+
79
+ // Init the environment explicitly
80
+ _ , _ , err := cli .Run ("core" , "update-index" )
81
+ require .NoError (t , err )
82
+
83
+ // Download latest AVR
84
+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr" )
85
+ require .NoError (t , err )
86
+
87
+ sketchName := "CompileWithExportBinariesFlag"
88
+ sketchPath := cli .SketchbookDir ().Join (sketchName )
89
+ fqbn := "arduino:avr:uno"
90
+
91
+ // Create a test sketch
92
+ _ , _ , err = cli .Run ("sketch" , "new" , sketchPath .String ())
93
+ require .NoError (t , err )
94
+
95
+ // Test the --output-dir flag with absolute path
96
+ _ , _ , err = cli .Run ("compile" , "-b" , fqbn , sketchPath .String (), "--export-binaries" )
97
+ require .NoError (t , err )
98
+ require .DirExists (t , sketchPath .Join ("build" ).String ())
99
+
100
+ // Verifies binaries are exported when --export-binaries flag is set
101
+ fqbn = strings .ReplaceAll (fqbn , ":" , "." )
102
+ require .FileExists (t , sketchPath .Join ("build" , fqbn , sketchName + ".ino.eep" ).String ())
103
+ require .FileExists (t , sketchPath .Join ("build" , fqbn , sketchName + ".ino.elf" ).String ())
104
+ require .FileExists (t , sketchPath .Join ("build" , fqbn , sketchName + ".ino.hex" ).String ())
105
+ require .FileExists (t , sketchPath .Join ("build" , fqbn , sketchName + ".ino.with_bootloader.bin" ).String ())
106
+ require .FileExists (t , sketchPath .Join ("build" , fqbn , sketchName + ".ino.with_bootloader.hex" ).String ())
107
+ }
0 commit comments