pkg/helmpath: fix unit test for Windows

Signed-off-by: Song Shukun <song.shukun@fujitsu.com>
pull/7629/head
Song Shukun 6 years ago
parent 512e1b8bc9
commit eda60a59b6

@ -23,9 +23,9 @@ import (
)
func TestHelmHome(t *testing.T) {
os.Setenv(xdg.XDGCacheHomeEnvVar, "c:\\")
os.Setenv(xdg.XDGConfigHomeEnvVar, "d:\\")
os.Setenv(xdg.XDGDataHomeEnvVar, "e:\\")
os.Setenv(xdg.CacheHomeEnvVar, "c:\\")
os.Setenv(xdg.ConfigHomeEnvVar, "d:\\")
os.Setenv(xdg.DataHomeEnvVar, "e:\\")
isEq := func(t *testing.T, a, b string) {
if a != b {
t.Errorf("Expected %q, got %q", b, a)

@ -32,7 +32,7 @@ const (
)
func TestDataPath(t *testing.T) {
os.Unsetenv(DataHomeEnvVar)
os.Unsetenv(xdg.DataHomeEnvVar)
os.Setenv("APPDATA", filepath.Join(homedir.HomeDir(), "foo"))
expected := filepath.Join(homedir.HomeDir(), "foo", appName, testFile)
@ -41,7 +41,7 @@ func TestDataPath(t *testing.T) {
t.Errorf("expected '%s', got '%s'", expected, lazy.dataPath(testFile))
}
os.Setenv(DataHomeEnvVar, filepath.Join(homedir.HomeDir(), "xdg"))
os.Setenv(xdg.DataHomeEnvVar, filepath.Join(homedir.HomeDir(), "xdg"))
expected = filepath.Join(homedir.HomeDir(), "xdg", appName, testFile)
@ -70,8 +70,8 @@ func TestConfigPath(t *testing.T) {
}
func TestCachePath(t *testing.T) {
os.Unsetenv(CacheHomeEnvVar)
os.Setenv("APPDATA", filepath.Join(homedir.HomeDir(), "foo"))
os.Unsetenv(xdg.CacheHomeEnvVar)
os.Setenv("TEMP", filepath.Join(homedir.HomeDir(), "foo"))
expected := filepath.Join(homedir.HomeDir(), "foo", appName, testFile)
@ -79,7 +79,7 @@ func TestCachePath(t *testing.T) {
t.Errorf("expected '%s', got '%s'", expected, lazy.cachePath(testFile))
}
os.Setenv(CacheHomeEnvVar, filepath.Join(homedir.HomeDir(), "xdg"))
os.Setenv(xdg.CacheHomeEnvVar, filepath.Join(homedir.HomeDir(), "xdg"))
expected = filepath.Join(homedir.HomeDir(), "xdg", appName, testFile)

Loading…
Cancel
Save