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: example test panic kills entire program #4670

Closed
rsc opened this issue Jan 17, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@rsc
Copy link
Contributor

commented Jan 17, 2013

A panic during an example test kills the entire test binary.
It should probably be caught and reported, the same way that an ordinary test does.
@adg

This comment has been minimized.

Copy link
Contributor

commented Jan 17, 2013

Comment 1:

Surprising! Investigating.
@adg

This comment has been minimized.

Copy link
Contributor

commented Jan 17, 2013

Comment 2:

This change makes examples behave the same as tests:
https://golang.org/cl/7148043
Note that tests that panic kill the test binary, too. The panic is re-thrown inside
tRunner:
        defer func() {
                t.duration = time.Now().Sub(t.start)
                // If the test panicked, print any test output before dying.
                if err := recover(); err != nil {
                        t.report()
                        panic(err)
                }
                t.signal <- t
        }()
The CL above makes examples do the same thing. Effectively, the one thing you get from
this is a "FAIL: ExampleFoo" line above the panic.
@adg

This comment has been minimized.

Copy link
Contributor

commented Jan 17, 2013

Comment 3:

Status changed to Started.

@adg

This comment has been minimized.

Copy link
Contributor

commented Jan 17, 2013

Comment 4:

This issue was closed by revision 5bd5ed2.

Status changed to Fixed.

@rsc rsc added fixed labels Jan 17, 2013

@rsc rsc assigned adg Jan 17, 2013

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

@rsc rsc removed the go1.1 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.
You can’t perform that action at this time.