MCPcopy
hub / github.com/stretchr/testify / NotPanics

Function NotPanics

assert/assertions.go:1357–1367  ·  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

1355//
1356// assert.NotPanics(t, func(){ RemainCalm() })
1357func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
1358 if h, ok := t.(tHelper); ok {
1359 h.Helper()
1360 }
1361
1362 if funcDidPanic, panicValue, panickedStack := didPanic(f); funcDidPanic {
1363 return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v\n\tPanic stack:\t%s", f, panicValue, panickedStack), msgAndArgs...)
1364 }
1365
1366 return true
1367}
1368
1369// WithinDuration asserts that the two times are within duration delta of each other.
1370//

Calls 3

didPanicFunction · 0.85
FailFunction · 0.70
HelperMethod · 0.65

Used in the wild real call sites across dependent graphs

searching dependent graphs…