Show stack trace on panic

pull/734/head
Sergej Zagursky 2019-02-11 17:50:19 +03:00 committed by George Lesica
parent 3f658bd5ac
commit 10a9f47426
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"os"
"reflect"
"regexp"
"runtime/debug"
"testing"
"github.com/stretchr/testify/assert"
@ -58,7 +59,7 @@ func (suite *Suite) Assert() *assert.Assertions {
func failOnPanic(t *testing.T) {
r := recover()
if r != nil {
t.Errorf("test panicked: %v", r)
t.Errorf("test panicked: %v\n%s", r, debug.Stack())
t.FailNow()
}
}