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

Function ExampleComparisonAssertionFunc

internal/testify/assert/assertions_test.go:2520–2548  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2518}
2519
2520func ExampleComparisonAssertionFunc() {
2521 t := &testing.T{} // provided by test
2522
2523 adder := func(x, y int) int {
2524 return x + y
2525 }
2526
2527 type args struct {
2528 x int
2529 y int
2530 }
2531
2532 tests := []struct {
2533 name string
2534 args args
2535 expect int
2536 assertion ComparisonAssertionFunc
2537 }{
2538 {"2+2=4", args{2, 2}, 4, Equal},
2539 {"2+2!=5", args{2, 2}, 5, NotEqual},
2540 {"2+3==5", args{2, 3}, 5, Exactly},
2541 }
2542
2543 for _, tt := range tests {
2544 t.Run(tt.name, func(t *testing.T) {
2545 tt.assertion(t, tt.expect, adder(tt.args.x, tt.args.y))
2546 })
2547 }
2548}
2549
2550func TestComparisonAssertionFunc(t *testing.T) {
2551 type iface interface {

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…