github.com/engineyard/workflow-cli@v2.21.6+incompatible/settings/home_windows_test.go (about) 1 // +build windows 2 3 package settings 4 5 import ( 6 "os" 7 "testing" 8 9 "github.com/arschles/assert" 10 ) 11 12 // TestFindHome ensures the correct home directory is returned by FindHome(). 13 func TestFindHome(t *testing.T) { 14 homedrive := "C:" 15 homepath := "/a/b/c" 16 os.Setenv("HOMEDRIVE", homedrive) 17 os.Setenv("HOMEPATH", homepath) 18 assert.Equal(t, FindHome(), homedrive+homepath, "output") 19 } 20 21 // TestSetHome ensures the correct env vars are set when SetHome() is called. 22 func TestSetHome(t *testing.T) { 23 homeDrive := "D:" 24 homePath := "/e/f/g" 25 SetHome(homeDrive + homePath) 26 27 assert.Equal(t, os.Getenv("HOMEDRIVE"), homeDrive, "output") 28 assert.Equal(t, os.Getenv("HOMEPATH"), homePath, "output") 29 }