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: panicing test is reported as PASSing #5149

Closed
gopherbot opened this issue Mar 28, 2013 · 4 comments
Closed

testing: panicing test is reported as PASSing #5149

gopherbot opened this issue Mar 28, 2013 · 4 comments
Milestone

Comments

@gopherbot
Copy link

by coocood:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. write a test method as following:
   func TestPanic(t *testing.T){
    panic("a")
    t.Fail()
   }
2. run "go test -v"

What is the expected output?

report "--- Fail:"

What do you see instead?

report "--- PASS:"

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

windows 7 sp1


Which version are you using?  (run 'go version')

devel +ff83e39f1348
@gopherbot
Copy link
Author

Comment 1 by coocood:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. write a test method as following:
   func TestPanic(t *testing.T){
    panic("a")
    t.Fail()
   }
2. run "go test -v"
What is the expected output?
report "--- Fail:"
What do you see instead?
report "--- PASS:"
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
windows 7 sp1
Which version are you using?  (run 'go version')
devel +ff83e39f1348

@davecheney
Copy link
Contributor

Comment 2:

A test that executes a raw panic will be marked as passing, although the entire test
suite is correctly marked as failing.
lucky(~/src/panic) % go test -v
=== RUN TestPanic
--- PASS: TestPanic (0.00 seconds)
panic: a [recovered]
        panic: a
goroutine 3 [running]:
testing.func·004()
        /home/dfc/go/src/pkg/testing/testing.go:341 +0xbc
panic.TestPanic(0xc200075000)
        /home/dfc/src/panic/t_test.go:6 +0x53
testing.tRunner(0xc200075000, 0x5b0a20)
        /home/dfc/go/src/pkg/testing/testing.go:346 +0x8a
created by testing.RunTests
        /home/dfc/go/src/pkg/testing/testing.go:426 +0x86b
goroutine 1 [chan receive]:
testing.RunTests(0x53a310, 0x5b0a20, 0x1, 0x1, 0x1, ...)
        /home/dfc/go/src/pkg/testing/testing.go:427 +0x88e
testing.Main(0x53a310, 0x5b0a20, 0x1, 0x1, 0x5b8420, ...)
        /home/dfc/go/src/pkg/testing/testing.go:358 +0x8a
main.main()
        panic/_test/_testmain.go:43 +0x9a
exit status 2
FAIL    panic   0.015s

Labels changed: added priority-soon, go1.1maybe, removed priority-triage.

Status changed to Accepted.

@gopherbot
Copy link
Author

Comment 3 by coocood:

My CL for this issue:
https://golang.org/cl/8136043/

@davecheney
Copy link
Contributor

Comment 4:

This issue was closed by revision 174a17e.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants