Merge pull request #7629 from sshukun/fix-unit-test

pkg/helmpath: fix unit test for Windows
pull/7643/head
Adam Reese 6 years ago committed by GitHub
commit 598dc504d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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