Panics asserts that the code inside the specified PanicTestFunc panics. assert.Panics(t, func(){ GoCrazy() })
(t TestingT, f PanicTestFunc, msgAndArgs ...interface{})
| 1212 | // |
| 1213 | // assert.Panics(t, func(){ GoCrazy() }) |
| 1214 | func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { |
| 1215 | if h, ok := t.(tHelper); ok { |
| 1216 | h.Helper() |
| 1217 | } |
| 1218 | |
| 1219 | if funcDidPanic, panicValue, _ := didPanic(f); !funcDidPanic { |
| 1220 | return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) |
| 1221 | } |
| 1222 | |
| 1223 | return true |
| 1224 | } |
| 1225 | |
| 1226 | // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that |
| 1227 | // the recovered panic value equals the expected panic value. |
searching dependent graphs…