mirror of
https://github.com/golang/go
synced 2024-11-18 21:44:45 -07: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:
parent
a7c698b070
commit
41a15a3013
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user