summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/stretchr/testify/suite/suite.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-08-13 16:14:26 +0200
committerGitHub <noreply@github.com>2022-08-13 16:14:26 +0200
commit6a3fc713978a0c1c9290a4afd08b47886b49b635 (patch)
treeaa62cd85cf5671646c75ee38b3fc140ef7edcea8 /vendor/github.com/stretchr/testify/suite/suite.go
parent3c4192ebf6a32e30cdd23a9644c2ceca72a006fa (diff)
downloadmatterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.gz
matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.bz2
matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.zip
Update dependencies and go1.18 (#1873)
* Update dependencies and go1.18 * Exclude unnecessary linters and update build to go1.18
Diffstat (limited to 'vendor/github.com/stretchr/testify/suite/suite.go')
-rw-r--r--vendor/github.com/stretchr/testify/suite/suite.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/vendor/github.com/stretchr/testify/suite/suite.go b/vendor/github.com/stretchr/testify/suite/suite.go
index 1c402e8d..89559187 100644
--- a/vendor/github.com/stretchr/testify/suite/suite.go
+++ b/vendor/github.com/stretchr/testify/suite/suite.go
@@ -67,8 +67,12 @@ func (suite *Suite) Assert() *assert.Assertions {
return suite.Assertions
}
-func failOnPanic(t *testing.T) {
+func recoverAndFailOnPanic(t *testing.T) {
r := recover()
+ failOnPanic(t, r)
+}
+
+func failOnPanic(t *testing.T, r interface{}) {
if r != nil {
t.Errorf("test panicked: %v\n%s", r, debug.Stack())
t.FailNow()
@@ -91,7 +95,7 @@ func (suite *Suite) Run(name string, subtest func()) bool {
// Run takes a testing suite and runs all of the tests attached
// to it.
func Run(t *testing.T, suite TestingSuite) {
- defer failOnPanic(t)
+ defer recoverAndFailOnPanic(t)
suite.SetT(t)
@@ -136,10 +140,12 @@ func Run(t *testing.T, suite TestingSuite) {
F: func(t *testing.T) {
parentT := suite.T()
suite.SetT(t)
- defer failOnPanic(t)
+ defer recoverAndFailOnPanic(t)
defer func() {
+ r := recover()
+
if stats != nil {
- passed := !t.Failed()
+ passed := !t.Failed() && r == nil
stats.end(method.Name, passed)
}
@@ -152,6 +158,7 @@ func Run(t *testing.T, suite TestingSuite) {
}
suite.SetT(parentT)
+ failOnPanic(t, r)
}()
if setupTestSuite, ok := suite.(SetupTestSuite); ok {