aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-03-06 21:52:37 -0500
committerRuss Cox <rsc@golang.org>2011-03-06 21:52:37 -0500
commit2b4a9603d33308ac8a13700dbb9489de115bd2ec (patch)
treec89f195e994cbd990a5e15063d6938bd05ecc45f
parent94401f524ea26f72afcb6454b0cd2c5c7749a7f5 (diff)
downloadgo-2b4a9603d33308ac8a13700dbb9489de115bd2ec.tar.gz
go-2b4a9603d33308ac8a13700dbb9489de115bd2ec.zip
io/ioutil: use filepath.Join, handle trailing / in $TMPDIR
R=niemeyer CC=golang-dev https://golang.org/cl/4256057
-rw-r--r--src/pkg/io/ioutil/tempfile_test.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pkg/io/ioutil/tempfile_test.go b/src/pkg/io/ioutil/tempfile_test.go
index 6013ec1d4a..80c62f672c 100644
--- a/src/pkg/io/ioutil/tempfile_test.go
+++ b/src/pkg/io/ioutil/tempfile_test.go
@@ -7,6 +7,7 @@ package ioutil_test
import (
. "io/ioutil"
"os"
+ "path/filepath"
"regexp"
"testing"
)
@@ -25,7 +26,7 @@ func TestTempFile(t *testing.T) {
if f != nil {
f.Close()
os.Remove(f.Name())
- re := regexp.MustCompile("^" + regexp.QuoteMeta(dir) + "/ioutil_test[0-9]+$")
+ re := regexp.MustCompile("^" + regexp.QuoteMeta(filepath.Join(dir, "ioutil_test")) + "[0-9]+$")
if !re.MatchString(f.Name()) {
t.Errorf("TempFile(`"+dir+"`, `ioutil_test`) created bad name %s", f.Name())
}
@@ -45,7 +46,7 @@ func TestTempDir(t *testing.T) {
}
if name != "" {
os.Remove(name)
- re := regexp.MustCompile("^" + regexp.QuoteMeta(dir) + "/ioutil_test[0-9]+$")
+ re := regexp.MustCompile("^" + regexp.QuoteMeta(filepath.Join(dir, "ioutil_test")) + "[0-9]+$")
if !re.MatchString(name) {
t.Errorf("TempDir(`"+dir+"`, `ioutil_test`) created bad name %s", name)
}