| 2919 | } |
| 2920 | |
| 2921 | func 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 | |
| 2940 | func TestPanicAssertionFunc(t *testing.T) { |
| 2941 | tests := []struct { |