Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: syntax errors not picked up if no tests cases #8555

Closed
mitchellh opened this issue Aug 19, 2014 · 6 comments

Comments

Projects
None yet
5 participants
@mitchellh
Copy link

commented Aug 19, 2014

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.
@mitchellh

This comment has been minimized.

Copy link
Author

commented Aug 19, 2014

Comment 1:

Verified this happens with go version devel +7e00313f3b3a Tue Aug 19 08:50:35 2014 -0700
darwin/amd64
@gopherbot

This comment has been minimized.

Copy link

commented Aug 20, 2014

Comment 2 by jason.beranek:

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]
@gopherbot

This comment has been minimized.

Copy link

commented Aug 20, 2014

Comment 3:

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
@gopherbot

This comment has been minimized.

Copy link

commented Aug 20, 2014

Comment 4:

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
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 20, 2014

Comment 5:

Labels changed: added repo-main, release-go1.4.

@josharian

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2014

Comment 6:

Looks like a duplicate of 8337. Please holler if I'm wrong.

Status changed to Duplicate.

Merged into issue #8337.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015

@rsc rsc removed the release-go1.4 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 25, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.