Commit 9e1b6cbd authored by Cristian Maglie's avatar Cristian Maglie

Fixed tests

parent ec48f1af
...@@ -85,9 +85,7 @@ func executeWithArgs(t *testing.T, args ...string) (exitCode int, output []byte) ...@@ -85,9 +85,7 @@ func executeWithArgs(t *testing.T, args ...string) (exitCode int, output []byte)
defer func() { defer func() {
output = redirect.GetOutput() output = redirect.GetOutput()
redirect.Close() redirect.Close()
fmt.Println("OUTPUT:")
fmt.Print(string(output)) fmt.Print(string(output))
fmt.Println("<END_OF_OUTPUT")
fmt.Println() fmt.Println()
}() }()
...@@ -153,13 +151,16 @@ func TestLibDownload(t *testing.T) { ...@@ -153,13 +151,16 @@ func TestLibDownload(t *testing.T) {
defer os.RemoveAll(tmp) defer os.RemoveAll(tmp)
configs.ArduinoDataFolder.SetPath(tmp) configs.ArduinoDataFolder.SetPath(tmp)
exitCode, d := executeWithArgs(t, "lib", "download", "inexistentLibrary", "--format", "json") exitCode, d := executeWithArgs(t, "core", "update-index")
require.Zero(t, exitCode, "exit code")
exitCode, d = executeWithArgs(t, "lib", "download", "inexistentLibrary", "--format", "json")
require.NotZero(t, exitCode, "exit code") require.NotZero(t, exitCode, "exit code")
require.Contains(t, string(d), "library not found: inexistentLibrary") require.Contains(t, string(d), "library inexistentLibrary not found")
exitCode, d = executeWithArgs(t, "lib", "download", "inexistentLibrary") exitCode, d = executeWithArgs(t, "lib", "download", "inexistentLibrary")
require.NotZero(t, exitCode, "exit code") require.NotZero(t, exitCode, "exit code")
require.Contains(t, string(d), "library not found: inexistentLibrary") require.Contains(t, string(d), "library inexistentLibrary not found")
exitCode, d = executeWithArgs(t, "lib", "download", "Audio") exitCode, d = executeWithArgs(t, "lib", "download", "Audio")
require.Zero(t, exitCode, "exit code") require.Zero(t, exitCode, "exit code")
...@@ -168,7 +169,7 @@ func TestLibDownload(t *testing.T) { ...@@ -168,7 +169,7 @@ func TestLibDownload(t *testing.T) {
exitCode, d = executeWithArgs(t, "lib", "download", "Audio@1.2.3-nonexistent") exitCode, d = executeWithArgs(t, "lib", "download", "Audio@1.2.3-nonexistent")
require.NotZero(t, exitCode, "exit code") require.NotZero(t, exitCode, "exit code")
require.Contains(t, string(d), "version not found") require.Contains(t, string(d), "not found")
} }
func updateCoreIndex(t *testing.T) { func updateCoreIndex(t *testing.T) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment