]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: convert TestIssue7108 to the script framework
authorMichael Matloob <matloob@golang.org>
Mon, 30 Dec 2019 21:41:39 +0000 (16:41 -0500)
committerMichael Matloob <matloob@golang.org>
Mon, 6 Jan 2020 15:47:54 +0000 (15:47 +0000)
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: Ic16a0c6c1eabeba003b9cff620e2911078fd6cf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/212813
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/go_test.go
src/cmd/go/testdata/script/test_badtest.txt
src/cmd/go/testdata/src/notest/hello.go [deleted file]

index 45d9ab6a89323900f337c0bfa147efb55a9b3316..7d37f512bf50e9c68ae68cc6745257f772820f35 100644 (file)
@@ -2588,14 +2588,6 @@ func TestListTemplateContextFunction(t *testing.T) {
        }
 }
 
-// cmd/go: "go test" should fail if package does not build
-func TestIssue7108(t *testing.T) {
-       tg := testgo(t)
-       defer tg.cleanup()
-       tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
-       tg.runFail("test", "notest")
-}
-
 func TestGoBuildTestOnly(t *testing.T) {
        tg := testgo(t)
        defer tg.cleanup()
index f5db6941a0d129e72d040fa0d2a52c9bc47518a6..e79fc511b3975e9788b35e099372f26bfb1f57df 100644 (file)
@@ -1,11 +1,21 @@
 env GO111MODULE=off
 
-! go test badtest/...
+! go test badtest/badexec
 ! stdout ^ok
 stdout ^FAIL\tbadtest/badexec
+
+! go test badtest/badsyntax
+! stdout ^ok
 stdout ^FAIL\tbadtest/badsyntax
+
+! go test badtest/badvar
+! stdout ^ok
 stdout ^FAIL\tbadtest/badvar
 
+! go test notest
+! stdout ^ok
+stderr '^notest.hello.go:6:1: syntax error: non-declaration statement outside function body' # Exercise issue #7108
+
 -- badtest/badexec/x_test.go --
 package badexec
 
@@ -30,3 +40,10 @@ package badvar_test
 func f() {
        _ = notdefined
 }
+-- notest/hello.go --
+package notest
+
+func hello() {
+       println("hello world")
+}
+Hello world
\ No newline at end of file
diff --git a/src/cmd/go/testdata/src/notest/hello.go b/src/cmd/go/testdata/src/notest/hello.go
deleted file mode 100644 (file)
index 7c42c32..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-package notest
-
-func hello() {
-       println("hello world")
-}
-Hello world