src/pkg/io/ioutil/tempfile_test.go | 5 +++-- diff --git a/src/pkg/io/ioutil/tempfile_test.go b/src/pkg/io/ioutil/tempfile_test.go index 6013ec1d4a42aa87ba5afe640a39550a917b992c..80c62f672c1bd7f9380719700f97afc4ca2bef91 100644 --- a/src/pkg/io/ioutil/tempfile_test.go +++ b/src/pkg/io/ioutil/tempfile_test.go @@ -7,6 +7,7 @@ import ( . "io/ioutil" "os" + "path/filepath" "regexp" "testing" ) @@ -25,7 +26,7 @@ } 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 @@ t.Errorf("TempDir(dir, `ioutil_test`) = %v, %v", name, err) } 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) }