You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
testing: syntax errors not picked up if no tests cases #8555
go version go1.3 darwin/amd64
Create two files:
"foo.go":
package foo
func foo() {
NOPE I AM A SYNTAX ERROR
}
j
"foo_test.go":
package foo
Then run `go test` and the test passes. If you add a single test case to `foo_test.go`,
then it errors as expected. I believe that this was not the behavior with Go 1.2 but
haven't verified. I have a lot of test cases for really basic packages that I just want
to test compilation, and it no longer is testing that, when it was before.
go 1.1.1 on windows/amd64 returned the following:
.\foo.go:4: syntax error: unexpected name, expecting semicolon or newline or }
.\foo.go:6: non-declaration statement outside function body
FAIL _/Z_/Downloads/foo_test [build failed]
I can confirm it did fail on 1.2 and it does not on 1.3.1:
$ go version
go version go1.2 linux/amd64
$ go test
# github.com/vdemario/foo
/home/vitordemario/ssd/golang/src/github.com/vdemario/foo/foo.go:4: syntax error:
unexpected name, expecting semicolon or newline or }
FAIL github.com/vdemario/foo [build failed]
$ go version
go version go1.3.1 linux/amd64
$ go test
testing: warning: no tests to run
PASS
ok github.com/vdemario/foo 0.001s
I can confirm it did fail on 1.2 and it does not on 1.3.1:
$ go version
go version go1.2 linux/amd64
$ go test
(...)
syntax error: unexpected name, expecting semicolon or newline or }
FAIL github.com/vdemario/foo [build failed]
$ go version
go version go1.3.1 linux/amd64
$ go test
testing: warning: no tests to run
PASS
ok github.com/vdemario/foo 0.001s
Activity
mitchellh commentedon Aug 19, 2014
Comment 1:
gopherbot commentedon Aug 20, 2014
Comment 2 by jason.beranek:
gopherbot commentedon Aug 20, 2014
Comment 3:
gopherbot commentedon Aug 20, 2014
Comment 4:
ianlancetaylor commentedon Aug 20, 2014
Comment 5:
Labels changed: added repo-main, release-go1.4.
josharian commentedon Sep 17, 2014
Comment 6:
Status changed to Duplicate.
Merged into issue #8337.