Skip to content

Commit

Permalink
cmd/go: convert TestIssue7108 to the script framework
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Jay Conrod <[email protected]>
  • Loading branch information
matloob committed Jan 6, 2020
1 parent 72f92de commit 2863969
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
8 changes: 0 additions & 8 deletions src/cmd/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
19 changes: 18 additions & 1 deletion src/cmd/go/testdata/script/test_badtest.txt
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -30,3 +40,10 @@ package badvar_test
func f() {
_ = notdefined
}
-- notest/hello.go --
package notest

func hello() {
println("hello world")
}
Hello world
6 changes: 0 additions & 6 deletions src/cmd/go/testdata/src/notest/hello.go

This file was deleted.

0 comments on commit 2863969

Please sign in to comment.