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{})
| 1895 | // |
| 1896 | // require.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) |
| 1897 | func 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. |