Commit 5a8b652c authored by Russ Cox's avatar Russ Cox

cmd/go: add test for tests with no tests

CL 122518 rolled back an earlier CL that made "go test"
start running test binaries for packages with no *_test.go files.
Add a test as another roadblock to reintroducing that behavior
in the future.

For #26462.

Change-Id: I898103064efee8d6ae65bcf74f4dffc830eae7e9
Reviewed-on: https://go-review.googlesource.com/122595
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent c8012325
......@@ -6452,6 +6452,16 @@ func TestCDAndGOPATHAreDifferent(t *testing.T) {
}
}
// Issue 26242.
func TestGoTestWithoutTests(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
tg.run("test", "testnorun")
tg.grepStdout(`testnorun\t\[no test files\]`, "do not want test to run")
}
// Issue 25579.
func TestGoBuildDashODevNull(t *testing.T) {
tg := testgo(t)
......
package p
func init() {
panic("go test must not link and run test binaries without tests")
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment