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
1 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,7 @@
package vcs package vcs
import ( import (
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
@ -50,7 +51,11 @@ func TestFromDir(t *testing.T) {
} }
tests := make([]testStruct, len(vcsList)) 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 { for i, vcs := range vcsList {
tests[i] = testStruct{ tests[i] = testStruct{
@ -67,5 +72,4 @@ func TestFromDir(t *testing.T) {
} }
os.RemoveAll(test.path) os.RemoveAll(test.path)
} }
os.RemoveAll(tempDir)
} }