MCPcopy Create free account
hub / github.com/stretchr/testify / NotPanics

Function NotPanics

assert/assertions.go:1305–1315  ·  view source on GitHub ↗

NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. assert.NotPanics(t, func(){ RemainCalm() })

(t TestingT, f PanicTestFunc, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

1303//
1304// assert.NotPanics(t, func(){ RemainCalm() })
1305func 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//

Calls 3

didPanicFunction · 0.85
FailFunction · 0.70
HelperMethod · 0.65