1
0
mirror of https://github.com/golang/go synced 2024-10-01 03:28:32 -06:00

go.tools/go/vcs: do not delete $TMPDIR during test runs

The test would nuke the entire contents of os.TempDir on completion.

This change corrects the code to use ioutil.TempDir.

R=r, adg
CC=golang-dev
https://golang.org/cl/12796045
This commit is contained in:
Dave Cheney 2013-08-19 16:22:31 +10:00
parent a7c698b070
commit 41a15a3013

View File

@ -5,6 +5,7 @@
package vcs
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
@ -50,7 +51,11 @@ func TestFromDir(t *testing.T) {
}
tests := make([]testStruct, len(vcsList))
tempDir := os.TempDir()
tempDir, err := ioutil.TempDir("", "vcstest")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tempDir)
for i, vcs := range vcsList {
tests[i] = testStruct{
@ -67,5 +72,4 @@ func TestFromDir(t *testing.T) {
}
os.RemoveAll(test.path)
}
os.RemoveAll(tempDir)
}