MCPcopy Create free account
hub / github.com/expr-lang/expr / ExampleBoolAssertionFunc

Function ExampleBoolAssertionFunc

internal/testify/require/requirements_test.go:495–518  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

493}
494
495func 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
520func TestBoolAssertionFunc(t *testing.T) {
521 tests := []struct {

Callers

nothing calls this directly

Calls 1

RunMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…