()
| 493 | } |
| 494 | |
| 495 | func ExampleBoolAssertionFunc() { |
| 496 | t := &testing.T{} // provided by test |
| 497 | |
| 498 | isOkay := func(x int) bool { |
| 499 | return x >= 42 |
| 500 | } |
| 501 | |
| 502 | tests := []struct { |
| 503 | name string |
| 504 | arg int |
| 505 | assertion BoolAssertionFunc |
| 506 | }{ |
| 507 | {"-1 is bad", -1, False}, |
| 508 | {"42 is good", 42, True}, |
| 509 | {"41 is bad", 41, False}, |
| 510 | {"45 is cool", 45, True}, |
| 511 | } |
| 512 | |
| 513 | for _, tt := range tests { |
| 514 | t.Run(tt.name, func(t *testing.T) { |
| 515 | tt.assertion(t, isOkay(tt.arg)) |
| 516 | }) |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | func TestBoolAssertionFunc(t *testing.T) { |
| 521 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…