()
| 2630 | } |
| 2631 | |
| 2632 | func ExampleBoolAssertionFunc() { |
| 2633 | t := &testing.T{} // provided by test |
| 2634 | |
| 2635 | isOkay := func(x int) bool { |
| 2636 | return x >= 42 |
| 2637 | } |
| 2638 | |
| 2639 | tests := []struct { |
| 2640 | name string |
| 2641 | arg int |
| 2642 | assertion BoolAssertionFunc |
| 2643 | }{ |
| 2644 | {"-1 is bad", -1, False}, |
| 2645 | {"42 is good", 42, True}, |
| 2646 | {"41 is bad", 41, False}, |
| 2647 | {"45 is cool", 45, True}, |
| 2648 | } |
| 2649 | |
| 2650 | for _, tt := range tests { |
| 2651 | t.Run(tt.name, func(t *testing.T) { |
| 2652 | tt.assertion(t, isOkay(tt.arg)) |
| 2653 | }) |
| 2654 | } |
| 2655 | } |
| 2656 | |
| 2657 | func TestBoolAssertionFunc(t *testing.T) { |
| 2658 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…