make tempfiles in os.TempDir() not $GOROOT

This commit is contained in:
Jimmy Zelinskie 2013-07-21 20:49:17 -04:00
parent db6d8707df
commit 2d40a3ab97

View file

@ -45,7 +45,7 @@ func TestNewConfig(t *testing.T) {
func writeAndOpenJsonTest(t *testing.T, fn string) { func writeAndOpenJsonTest(t *testing.T, fn string) {
expandFn := os.ExpandEnv(fn) expandFn := os.ExpandEnv(fn)
//write json to relative path, clean up // Write JSON to relative path, clean up
tfile, ferr := os.Create(expandFn) tfile, ferr := os.Create(expandFn)
// Remove failure not counted as error // Remove failure not counted as error
defer os.Remove(expandFn) defer os.Remove(expandFn)
@ -82,7 +82,7 @@ func TestOpenCurDir(t *testing.T) {
} }
func TestOpenAbsEnvPath(t *testing.T) { func TestOpenAbsEnvPath(t *testing.T) {
if !testing.Short() { if !testing.Short() {
writeAndOpenJsonTest(t, "$GOROOT/testConfig.json") writeAndOpenJsonTest(t, os.TempDir()+"testConfig.json")
} else { } else {
t.Log("Write/Read file test skipped") t.Log("Write/Read file test skipped")
} }