MCPcopy Create free account
hub / github.com/stretchr/testify / ExamplePanicAssertionFunc

Function ExamplePanicAssertionFunc

assert/assertions_test.go:2921–2938  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2919}
2920
2921func ExamplePanicAssertionFunc() {
2922 t := &testing.T{} // provided by test
2923
2924 tests := []struct {
2925 name string
2926 panicFn PanicTestFunc
2927 assertion PanicAssertionFunc
2928 }{
2929 {"with panic", func() { panic(nil) }, Panics},
2930 {"without panic", func() {}, NotPanics},
2931 }
2932
2933 for _, tt := range tests {
2934 t.Run(tt.name, func(t *testing.T) {
2935 tt.assertion(t, tt.panicFn)
2936 })
2937 }
2938}
2939
2940func TestPanicAssertionFunc(t *testing.T) {
2941 tests := []struct {

Callers

nothing calls this directly

Calls 1

RunMethod · 0.65

Tested by

no test coverage detected