}
}
-func TestErrorMessageForSyntaxErrorInTestGoFileSaysFAIL(t *testing.T) {
- tg := testgo(t)
- defer tg.cleanup()
- tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
- tg.runFail("test", "syntaxerror")
- tg.grepStderr("x_test.go:", "did not diagnose error")
- tg.grepStdout("FAIL", "go test did not say FAIL")
-}
-
func TestWildcardsDoNotLookInUselessDirectories(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()
tg.grepBoth(noMatchesPattern, "go test did not say [no tests to run]")
}
-func TestMatchesNoTestsDoesNotOverrideBuildFailure(t *testing.T) {
- tg := testgo(t)
- defer tg.cleanup()
- tg.parallel()
- tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
- tg.runFail("test", "-run", "ThisWillNotMatch", "syntaxerror")
- tg.grepBothNot(noMatchesPattern, "go test did say [no tests to run]")
- tg.grepBoth("FAIL", "go test did not say FAIL")
-}
-
func TestMatchesNoBenchmarksIsOK(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()
--- /dev/null
+# Test that when there's a build failure and a -run flag that doesn't match,
+# that the error for not matching tests does not override the error for
+# the build failure.
+
+! go test -run ThisWillNotMatch syntaxerror
+! stderr '(?m)^ok.*\[no tests to run\]'
+stdout 'FAIL'
+
+-- syntaxerror/x.go --
+package p
+-- syntaxerror/x_test.go --
+package p
+
+func f() (x.y, z int) {
+}
--- /dev/null
+# Test that the error message for a syntax error in a test go file
+# says FAIL.
+
+! go test syntaxerror
+stderr 'x_test.go:' # check that the error is diagnosed
+stdout 'FAIL' # check that go test says FAIL
+
+-- syntaxerror/x.go --
+package p
+-- syntaxerror/x_test.go --
+package p
+
+func f() (x.y, z int) {
+}