()
| 2715 | } |
| 2716 | |
| 2717 | func ExamplePanicAssertionFunc() { |
| 2718 | t := &testing.T{} // provided by test |
| 2719 | |
| 2720 | tests := []struct { |
| 2721 | name string |
| 2722 | panicFn PanicTestFunc |
| 2723 | assertion PanicAssertionFunc |
| 2724 | }{ |
| 2725 | {"with panic", func() { panic(nil) }, Panics}, |
| 2726 | {"without panic", func() {}, NotPanics}, |
| 2727 | } |
| 2728 | |
| 2729 | for _, tt := range tests { |
| 2730 | t.Run(tt.name, func(t *testing.T) { |
| 2731 | tt.assertion(t, tt.panicFn) |
| 2732 | }) |
| 2733 | } |
| 2734 | } |
| 2735 | |
| 2736 | func TestPanicAssertionFunc(t *testing.T) { |
| 2737 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…