@@ -390,14 +390,40 @@ func TestCompileCommands(t *testing.T) {
390390 require .Contains (t , string (d ), "Sketch created" )
391391
392392 // Build sketch for arduino:avr:uno
393- exitCode , d = executeWithArgs (t , "compile" , "-b" , "arduino:avr:uno" , currSketchbookDir .Join ("Test1" ).String ())
393+ test1 := currSketchbookDir .Join ("Test1" ).String ()
394+ exitCode , d = executeWithArgs (t , "compile" , "-b" , "arduino:avr:uno" , test1 )
394395 require .Zero (t , exitCode , "exit code" )
395396 require .Contains (t , string (d ), "Sketch uses" )
397+ require .True (t , paths .New (test1 ).Join ("Test1.arduino.avr.uno.hex" ).Exist ())
396398
397399 // Build sketch for arduino:avr:nano (without options)
398- exitCode , d = executeWithArgs (t , "compile" , "-b" , "arduino:avr:nano" , currSketchbookDir . Join ( "Test1" ). String () )
400+ exitCode , d = executeWithArgs (t , "compile" , "-b" , "arduino:avr:nano" , test1 )
399401 require .Zero (t , exitCode , "exit code" )
400402 require .Contains (t , string (d ), "Sketch uses" )
403+ require .True (t , paths .New (test1 ).Join ("Test1.arduino.avr.nano.hex" ).Exist ())
404+
405+ // Build sketch with --output path
406+ require .NoError (t , os .Chdir (tmp ))
407+ exitCode , d = executeWithArgs (t , "compile" , "-b" , "arduino:avr:nano" , "-o" , "test" , test1 )
408+ require .Zero (t , exitCode , "exit code" )
409+ require .Contains (t , string (d ), "Sketch uses" )
410+ require .True (t , paths .New ("test.hex" ).Exist ())
411+
412+ exitCode , d = executeWithArgs (t , "compile" , "-b" , "arduino:avr:nano" , "-o" , "test2.hex" , test1 )
413+ require .Zero (t , exitCode , "exit code" )
414+ require .Contains (t , string (d ), "Sketch uses" )
415+ require .True (t , paths .New ("test2.hex" ).Exist ())
416+ require .NoError (t , paths .New (tmp , "anothertest" ).MkdirAll ())
417+
418+ exitCode , d = executeWithArgs (t , "compile" , "-b" , "arduino:avr:nano" , "-o" , "anothertest/test" , test1 )
419+ require .Zero (t , exitCode , "exit code" )
420+ require .Contains (t , string (d ), "Sketch uses" )
421+ require .True (t , paths .New ("anothertest" , "test.hex" ).Exist ())
422+
423+ exitCode , d = executeWithArgs (t , "compile" , "-b" , "arduino:avr:nano" , "-o" , tmp + "/anothertest/test2" , test1 )
424+ require .Zero (t , exitCode , "exit code" )
425+ require .Contains (t , string (d ), "Sketch uses" )
426+ require .True (t , paths .New ("anothertest" , "test2.hex" ).Exist ())
401427}
402428
403429func TestCoreCommands (t * testing.T ) {
0 commit comments