mirror of https://github.com/stretchr/testify.git
fix: panic behavior for subtests
This fix adds panic handling for subtests which will achieve: - subtests will fail for the correct test context when panicking - the test execution is not stopped; the next subtest will be executedpull/1423/head
parent
65318c364a
commit
a4a54a4597
|
@ -98,9 +98,10 @@ func (suite *Suite) Run(name string, subtest func()) bool {
|
||||||
|
|
||||||
return oldT.Run(name, func(t *testing.T) {
|
return oldT.Run(name, func(t *testing.T) {
|
||||||
suite.SetT(t)
|
suite.SetT(t)
|
||||||
|
|
||||||
defer suite.SetT(oldT)
|
defer suite.SetT(oldT)
|
||||||
|
|
||||||
|
defer recoverAndFailOnPanic(t)
|
||||||
|
|
||||||
if setupSubTest, ok := suite.s.(SetupSubTest); ok {
|
if setupSubTest, ok := suite.s.(SetupSubTest); ok {
|
||||||
setupSubTest.SetupSubTest()
|
setupSubTest.SetupSubTest()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue