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

Function PanicsWithErrorf

require/require.go:1883–1891  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

1881//
1882// require.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
1883func PanicsWithErrorf(t TestingT, errString string, f assert.PanicTestFunc, msg string, args ...interface{}) {
1884 if h, ok := t.(tHelper); ok {
1885 h.Helper()
1886 }
1887 if assert.PanicsWithErrorf(t, errString, f, msg, args...) {
1888 return
1889 }
1890 t.FailNow()
1891}
1892
1893// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
1894// the recovered panic value equals the expected panic value.

Callers 1

PanicsWithErrorfMethod · 0.70

Calls 3

PanicsWithErrorfFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected