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

Function TestComparisonAssertionFunc

assert/assertions_test.go:2754–2785  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2752}
2753
2754func TestComparisonAssertionFunc(t *testing.T) {
2755 type iface interface {
2756 Name() string
2757 }
2758
2759 tests := []struct {
2760 name string
2761 expect interface{}
2762 got interface{}
2763 assertion ComparisonAssertionFunc
2764 }{
2765 {"implements", (*iface)(nil), t, Implements},
2766 {"isType", (*testing.T)(nil), t, IsType},
2767 {"equal", t, t, Equal},
2768 {"equalValues", t, t, EqualValues},
2769 {"notEqualValues", t, nil, NotEqualValues},
2770 {"exactly", t, t, Exactly},
2771 {"notEqual", t, nil, NotEqual},
2772 {"notContains", []int{1, 2, 3}, 4, NotContains},
2773 {"subset", []int{1, 2, 3, 4}, []int{2, 3}, Subset},
2774 {"notSubset", []int{1, 2, 3, 4}, []int{0, 3}, NotSubset},
2775 {"elementsMatch", []byte("abc"), []byte("bac"), ElementsMatch},
2776 {"regexp", "^t.*y$", "testify", Regexp},
2777 {"notRegexp", "^t.*y$", "Testify", NotRegexp},
2778 }
2779
2780 for _, tt := range tests {
2781 t.Run(tt.name, func(t *testing.T) {
2782 tt.assertion(t, tt.expect, tt.got)
2783 })
2784 }
2785}
2786
2787func ExampleValueAssertionFunc() {
2788 t := &testing.T{} // provided by test

Callers

nothing calls this directly

Calls 1

RunMethod · 0.65

Tested by

no test coverage detected