| 106 | } |
| 107 | |
| 108 | func TestSuiteRecoverPanic(t *testing.T) { |
| 109 | ok := true |
| 110 | panickingTests := []testing.InternalTest{ |
| 111 | { |
| 112 | Name: t.Name() + "/InSetupSuite", |
| 113 | F: func(t *testing.T) { Run(t, &panickingSuite{panicInSetupSuite: true}) }, |
| 114 | }, |
| 115 | { |
| 116 | Name: t.Name() + "/InSetupTest", |
| 117 | F: func(t *testing.T) { Run(t, &panickingSuite{panicInSetupTest: true}) }, |
| 118 | }, |
| 119 | { |
| 120 | Name: t.Name() + "InBeforeTest", |
| 121 | F: func(t *testing.T) { Run(t, &panickingSuite{panicInBeforeTest: true}) }, |
| 122 | }, |
| 123 | { |
| 124 | Name: t.Name() + "/InTest", |
| 125 | F: func(t *testing.T) { Run(t, &panickingSuite{panicInTest: true}) }, |
| 126 | }, |
| 127 | { |
| 128 | Name: t.Name() + "/InAfterTest", |
| 129 | F: func(t *testing.T) { Run(t, &panickingSuite{panicInAfterTest: true}) }, |
| 130 | }, |
| 131 | { |
| 132 | Name: t.Name() + "/InTearDownTest", |
| 133 | F: func(t *testing.T) { Run(t, &panickingSuite{panicInTearDownTest: true}) }, |
| 134 | }, |
| 135 | { |
| 136 | Name: t.Name() + "/InTearDownSuite", |
| 137 | F: func(t *testing.T) { Run(t, &panickingSuite{panicInTearDownSuite: true}) }, |
| 138 | }, |
| 139 | } |
| 140 | |
| 141 | require.NotPanics(t, func() { |
| 142 | ok = testing.RunTests(allTestsFilter, panickingTests) |
| 143 | }) |
| 144 | |
| 145 | assert.False(t, ok) |
| 146 | } |
| 147 | |
| 148 | // This suite is intended to store values to make sure that only |
| 149 | // testing-suite-related methods are run. It's also a fully |