mirror of
https://github.com/stretchr/testify.git
synced 2025-05-31 11:42:44 +00:00
Show stack trace on panic
This commit is contained in:
parent
3f658bd5ac
commit
10a9f47426
@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime/debug"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -58,7 +59,7 @@ func (suite *Suite) Assert() *assert.Assertions {
|
|||||||
func failOnPanic(t *testing.T) {
|
func failOnPanic(t *testing.T) {
|
||||||
r := recover()
|
r := recover()
|
||||||
if r != nil {
|
if r != nil {
|
||||||
t.Errorf("test panicked: %v", r)
|
t.Errorf("test panicked: %v\n%s", r, debug.Stack())
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user