aboutsummaryrefslogtreecommitdiff
path: root/src/io
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2020-04-01 10:43:57 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2020-04-02 22:13:55 +0000
commit888a0c8ef6afb752aafd147eda40d62796d87cb3 (patch)
tree62c1b91c9630dc9d0e13a4c47a8761d49c22e53b /src/io
parent2bed279721d684de828d0027db43a9d6283938a1 (diff)
downloadgo-888a0c8ef6afb752aafd147eda40d62796d87cb3.tar.gz
go-888a0c8ef6afb752aafd147eda40d62796d87cb3.zip
testing: add TB.TempDir
Fixes #35998 Change-Id: I87c6bf4e34e832be68862ca16ecfa6ea12048d31 Reviewed-on: https://go-review.googlesource.com/c/go/+/226877 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/io')
-rw-r--r--src/io/ioutil/export_test.go7
-rw-r--r--src/io/ioutil/ioutil_test.go3
-rw-r--r--src/io/ioutil/tempfile_test.go11
3 files changed, 15 insertions, 6 deletions
diff --git a/src/io/ioutil/export_test.go b/src/io/ioutil/export_test.go
new file mode 100644
index 0000000000..dff55f07e2
--- /dev/null
+++ b/src/io/ioutil/export_test.go
@@ -0,0 +1,7 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ioutil
+
+var ErrPatternHasSeparator = errPatternHasSeparator
diff --git a/src/io/ioutil/ioutil_test.go b/src/io/ioutil/ioutil_test.go
index ef3c6d7975..db85755bdb 100644
--- a/src/io/ioutil/ioutil_test.go
+++ b/src/io/ioutil/ioutil_test.go
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package ioutil
+package ioutil_test
import (
"bytes"
+ . "io/ioutil"
"os"
"path/filepath"
"testing"
diff --git a/src/io/ioutil/tempfile_test.go b/src/io/ioutil/tempfile_test.go
index 469d2c98b3..fcc5101fcc 100644
--- a/src/io/ioutil/tempfile_test.go
+++ b/src/io/ioutil/tempfile_test.go
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package ioutil
+package ioutil_test
import (
+ . "io/ioutil"
"os"
"path/filepath"
"regexp"
@@ -59,7 +60,7 @@ func TestTempFile_BadPattern(t *testing.T) {
tests := []struct {
pattern string
wantErr bool
- } {
+ }{
{"ioutil*test", false},
{"ioutil_test*foo", false},
{"ioutil_test" + sep + "foo", true},
@@ -80,7 +81,7 @@ func TestTempFile_BadPattern(t *testing.T) {
if err == nil {
t.Errorf("Expected an error for pattern %q", tt.pattern)
}
- if g, w := err, errPatternHasSeparator; g != w {
+ if g, w := err, ErrPatternHasSeparator; g != w {
t.Errorf("Error mismatch: got %#v, want %#v for pattern %q", g, w, tt.pattern)
}
} else if err != nil {
@@ -166,7 +167,7 @@ func TestTempDir_BadPattern(t *testing.T) {
tests := []struct {
pattern string
wantErr bool
- } {
+ }{
{"ioutil*test", false},
{"ioutil_test*foo", false},
{"ioutil_test" + sep + "foo", true},
@@ -182,7 +183,7 @@ func TestTempDir_BadPattern(t *testing.T) {
if err == nil {
t.Errorf("Expected an error for pattern %q", tt.pattern)
}
- if g, w := err, errPatternHasSeparator; g != w {
+ if g, w := err, ErrPatternHasSeparator; g != w {
t.Errorf("Error mismatch: got %#v, want %#v for pattern %q", g, w, tt.pattern)
}
} else if err != nil {