NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. assert.NotPanics(t, func(){ RemainCalm() })
(t TestingT, f PanicTestFunc, msgAndArgs ...interface{})
| 1303 | // |
| 1304 | // assert.NotPanics(t, func(){ RemainCalm() }) |
| 1305 | func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { |
| 1306 | if h, ok := t.(tHelper); ok { |
| 1307 | h.Helper() |
| 1308 | } |
| 1309 | |
| 1310 | if funcDidPanic, panicValue, panickedStack := didPanic(f); funcDidPanic { |
| 1311 | return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v\n\tPanic stack:\t%s", f, panicValue, panickedStack), msgAndArgs...) |
| 1312 | } |
| 1313 | |
| 1314 | return true |
| 1315 | } |
| 1316 | |
| 1317 | // WithinDuration asserts that the two times are within duration delta of each other. |
| 1318 | // |