Skip to content

Commit ed033ed

Browse files
committed
Added test for build without FQBN-configs
1 parent 61932eb commit ed033ed

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

Diff for: commands/commands_test.go

+31-9
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,37 @@ func detectLatestAVRCore(t *testing.T) string {
369369
return latest.String()
370370
}
371371

372+
func TestCompileCommands(t *testing.T) {
373+
defer makeTempDataDir(t)()
374+
defer makeTempSketchbookDir(t)()
375+
376+
// Set staging dir to a temporary dir
377+
tmp, err := ioutil.TempDir(os.TempDir(), "test")
378+
require.NoError(t, err, "making temporary staging dir")
379+
defer os.RemoveAll(tmp)
380+
381+
updateCoreIndex(t)
382+
383+
// Download latest AVR
384+
exitCode, _ := executeWithArgs(t, "core", "install", "arduino:avr")
385+
require.Zero(t, exitCode, "exit code")
386+
387+
// Create a test sketch
388+
exitCode, d := executeWithArgs(t, "sketch", "new", "Test1")
389+
require.Zero(t, exitCode, "exit code")
390+
require.Contains(t, string(d), "Sketch created")
391+
392+
// Build sketch for arduino:avr:uno
393+
exitCode, d = executeWithArgs(t, "compile", "-b", "arduino:avr:uno", currSketchbookDir.Join("Test1").String())
394+
require.Zero(t, exitCode, "exit code")
395+
require.Contains(t, string(d), "Sketch uses")
396+
397+
// Build sketch for arduino:avr:nano (without options)
398+
exitCode, d = executeWithArgs(t, "compile", "-b", "arduino:avr:nano", currSketchbookDir.Join("Test1").String())
399+
require.Zero(t, exitCode, "exit code")
400+
require.Contains(t, string(d), "Sketch uses")
401+
}
402+
372403
func TestCoreCommands(t *testing.T) {
373404
defer makeTempDataDir(t)()
374405
defer makeTempSketchbookDir(t)()
@@ -473,15 +504,6 @@ func TestCoreCommands(t *testing.T) {
473504
require.Zero(t, exitCode, "exit code")
474505
require.Contains(t, string(d), "arduino:avr")
475506

476-
// Build sketch for arduino:avr:uno
477-
exitCode, d = executeWithArgs(t, "sketch", "new", "Test1")
478-
require.Zero(t, exitCode, "exit code")
479-
require.Contains(t, string(d), "Sketch created")
480-
481-
exitCode, d = executeWithArgs(t, "compile", "-b", "arduino:avr:uno", currSketchbookDir.Join("Test1").String())
482-
require.Zero(t, exitCode, "exit code")
483-
require.Contains(t, string(d), "Sketch uses")
484-
485507
// Uninstall arduino:avr
486508
exitCode, d = executeWithArgs(t, "core", "uninstall", "arduino:avr")
487509
require.Zero(t, exitCode, "exit code")

0 commit comments

Comments
 (0)