mirror of
https://github.com/helm/helm.git
synced 2026-08-09 01:21:20 +00:00
pkg/helmpath: fix unit test for Windows
Signed-off-by: Song Shukun <song.shukun@fujitsu.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user