aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-11-11 17:15:03 -0500
committerBryan C. Mills <bcmills@google.com>2019-11-11 22:40:24 +0000
commit49ac23a3cfeae205324d3ddc848459d2f183ab68 (patch)
tree32d60855bbcdbd40606ecb7c212c7e56ae491b39 /src
parent0c703b37dffe74d3fffc04347884bb0ee2fba5b3 (diff)
downloadgo-49ac23a3cfeae205324d3ddc848459d2f183ab68.tar.xz
cmd/go: convert TestFmtLoadErrors to a script test
This test failed in a pending CL, and I would rather debug it as a script. Change-Id: I0ae7486a9949bea40d5dd36afe6919f86f14dfa7 Reviewed-on: https://go-review.googlesource.com/c/go/+/206499 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/go_test.go8
-rw-r--r--src/cmd/go/testdata/script/fmt_load_errors.txt19
2 files changed, 19 insertions, 8 deletions
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index 1016a737a0..cb89cadb83 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -5704,14 +5704,6 @@ func TestInstallDeps(t *testing.T) {
tg.mustExist(p1)
}
-func TestFmtLoadErrors(t *testing.T) {
- tg := testgo(t)
- defer tg.cleanup()
- tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
- tg.runFail("fmt", "does-not-exist")
- tg.run("fmt", "-n", "exclude")
-}
-
func TestGoTestMinusN(t *testing.T) {
// Intent here is to verify that 'go test -n' works without crashing.
// This reuses flag_test.go, but really any test would do.
diff --git a/src/cmd/go/testdata/script/fmt_load_errors.txt b/src/cmd/go/testdata/script/fmt_load_errors.txt
new file mode 100644
index 0000000000..297ec0fe3c
--- /dev/null
+++ b/src/cmd/go/testdata/script/fmt_load_errors.txt
@@ -0,0 +1,19 @@
+env GO111MODULE=off
+
+! go fmt does-not-exist
+
+go fmt -n exclude
+stdout 'exclude[/\\]x\.go'
+stdout 'exclude[/\\]x_linux\.go'
+
+-- exclude/empty/x.txt --
+-- exclude/ignore/_x.go --
+package x
+-- exclude/x.go --
+// +build linux,!linux
+
+package x
+-- exclude/x_linux.go --
+// +build windows
+
+package x