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

Function PanicsWithError

require/require.go:1868–1876  ·  view source on GitHub ↗

PanicsWithError asserts that the code inside the specified PanicTestFunc panics, and that the recovered panic value is an error that satisfies the EqualError comparison. require.PanicsWithError(t, "crazy error", func(){ GoCrazy() })

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

Source from the content-addressed store, hash-verified

1866//
1867// require.PanicsWithError(t, "crazy error", func(){ GoCrazy() })
1868func PanicsWithError(t TestingT, errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
1869 if h, ok := t.(tHelper); ok {
1870 h.Helper()
1871 }
1872 if assert.PanicsWithError(t, errString, f, msgAndArgs...) {
1873 return
1874 }
1875 t.FailNow()
1876}
1877
1878// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc
1879// panics, and that the recovered panic value is an error that satisfies the

Callers 1

PanicsWithErrorMethod · 0.70

Calls 3

PanicsWithErrorFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected