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

Function PanicsWithValue

require/require.go:1897–1905  ·  view source on GitHub ↗

PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that the recovered panic value equals the expected panic value. require.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })

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

Source from the content-addressed store, hash-verified

1895//
1896// require.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
1897func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
1898 if h, ok := t.(tHelper); ok {
1899 h.Helper()
1900 }
1901 if assert.PanicsWithValue(t, expected, f, msgAndArgs...) {
1902 return
1903 }
1904 t.FailNow()
1905}
1906
1907// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
1908// the recovered panic value equals the expected panic value.

Calls 3

PanicsWithValueFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65