...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package helmpath
17
18 import (
19 "os"
20 "testing"
21
22 "helm.sh/helm/v3/pkg/helmpath/xdg"
23 )
24
25 func TestHelmHome(t *testing.T) {
26 os.Setenv(xdg.CacheHomeEnvVar, "c:\\")
27 os.Setenv(xdg.ConfigHomeEnvVar, "d:\\")
28 os.Setenv(xdg.DataHomeEnvVar, "e:\\")
29 isEq := func(t *testing.T, a, b string) {
30 if a != b {
31 t.Errorf("Expected %q, got %q", b, a)
32 }
33 }
34
35 isEq(t, CachePath(), "c:\\helm")
36 isEq(t, ConfigPath(), "d:\\helm")
37 isEq(t, DataPath(), "e:\\helm")
38
39
40 os.Setenv(xdg.CacheHomeEnvVar, "f:\\")
41
42 isEq(t, CachePath(), "f:\\helm")
43 }
44
View as plain text