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

Function ExampleBoolAssertionFunc

assert/assertions_test.go:2836–2859  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2834}
2835
2836func ExampleBoolAssertionFunc() {
2837 t := &testing.T{} // provided by test
2838
2839 isOkay := func(x int) bool {
2840 return x >= 42
2841 }
2842
2843 tests := []struct {
2844 name string
2845 arg int
2846 assertion BoolAssertionFunc
2847 }{
2848 {"-1 is bad", -1, False},
2849 {"42 is good", 42, True},
2850 {"41 is bad", 41, False},
2851 {"45 is cool", 45, True},
2852 }
2853
2854 for _, tt := range tests {
2855 t.Run(tt.name, func(t *testing.T) {
2856 tt.assertion(t, isOkay(tt.arg))
2857 })
2858 }
2859}
2860
2861func TestBoolAssertionFunc(t *testing.T) {
2862 tests := []struct {

Callers

nothing calls this directly

Calls 1

RunMethod · 0.65

Tested by

no test coverage detected