1
0
mirror of https://github.com/golang/go synced 2024-11-24 16:50:13 -07:00

testing: do not recover example's panic

So as to give out stack trace for panic in examples.
        This behavior also matches the tests'.
        Fixes #2691.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5554061
This commit is contained in:
Shenghou Ma 2012-01-19 10:19:33 -08:00 committed by Rob Pike
parent e5c1f3870b
commit d888ab80a3

View File

@ -25,13 +25,6 @@ func RunExamples(examples []InternalExample) (ok bool) {
var eg InternalExample var eg InternalExample
stdout, stderr := os.Stdout, os.Stderr stdout, stderr := os.Stdout, os.Stderr
defer func() {
os.Stdout, os.Stderr = stdout, stderr
if e := recover(); e != nil {
fmt.Printf("--- FAIL: %s\npanic: %v\n", eg.Name, e)
os.Exit(1)
}
}()
for _, eg = range examples { for _, eg = range examples {
if *chatty { if *chatty {