Commit 087a6f56 authored by Cristian Maglie's avatar Cristian Maglie

Fixed FindConfigFileInArgsFallbackOnEnv unit test

parent 61b66a70
......@@ -16,6 +16,7 @@
package configuration
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
......@@ -41,8 +42,9 @@ func TestInit(t *testing.T) {
}
func TestFindConfigFile(t *testing.T) {
defaultConfigFile := filepath.Join(getDefaultArduinoDataDir(), "arduino-cli.yaml")
configFile := FindConfigFileInArgsFallbackOnEnv([]string{"--config-file"})
require.Equal(t, "", configFile)
require.Equal(t, defaultConfigFile, configFile)
configFile = FindConfigFileInArgsFallbackOnEnv([]string{"--config-file", "some/path/to/config"})
require.Equal(t, "some/path/to/config", configFile)
......@@ -51,7 +53,7 @@ func TestFindConfigFile(t *testing.T) {
require.Equal(t, "some/path/to/config/arduino-cli.yaml", configFile)
configFile = FindConfigFileInArgsFallbackOnEnv([]string{})
require.Equal(t, "", configFile)
require.Equal(t, defaultConfigFile, configFile)
t.Setenv("ARDUINO_CONFIG_FILE", "some/path/to/config")
configFile = FindConfigFileInArgsFallbackOnEnv([]string{})
......
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