mirror of
https://github.com/stretchr/testify.git
synced 2025-07-08 03:28:25 +00:00
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 executed
This commit is contained in:
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) {
|
||||
suite.SetT(t)
|
||||
|
||||
defer suite.SetT(oldT)
|
||||
|
||||
defer recoverAndFailOnPanic(t)
|
||||
|
||||
if setupSubTest, ok := suite.s.(SetupSubTest); ok {
|
||||
setupSubTest.SetupSubTest()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user