@@ -25,10 +25,11 @@ type tHelper interface {
2525//
2626// assert.StrictEqual(t, 123, int64(123))
2727//
28- func Equal (t TestingT , expected , actual interface {} , msgAndArgs ... interface {} ) bool {
28+ func Equal [ A any , B any ] (t TestingT , expected A , actual B , msgAndArgs ... any ) bool {
2929 if h , ok := t .(tHelper ); ok {
3030 h .Helper ()
3131 }
32+
3233 return testifyAssert .EqualValues (t , expected , actual , msgAndArgs ... )
3334}
3435
@@ -37,10 +38,11 @@ func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{})
3738// assert.StrictEqual(t, 123, 123)
3839// assert.StrictEqual(t, 123, int64(123)) // fail
3940//
40- func StrictEqual (t TestingT , expected , actual interface {} , msgAndArgs ... interface {} ) bool {
41+ func StrictEqual [ A any , B any ] (t TestingT , expected A , actual B , msgAndArgs ... any ) bool {
4142 if h , ok := t .(tHelper ); ok {
4243 h .Helper ()
4344 }
45+
4446 return testifyAssert .Equal (t , expected , actual , msgAndArgs ... )
4547}
4648
@@ -50,7 +52,7 @@ func StrictEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interfa
5052// assert.NotEqual(t, 12, int32(12)) // fail
5153// assert.NotEqual(t, 12, int32(13)) // ok
5254//
53- func NotEqual (t TestingT , expected , actual interface {} , msgAndArgs ... interface {} ) bool {
55+ func NotEqual [ A any , B any ] (t TestingT , expected A , actual B , msgAndArgs ... any ) bool {
5456 if h , ok := t .(tHelper ); ok {
5557 h .Helper ()
5658 }
@@ -63,7 +65,7 @@ func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{
6365//
6466// Both arguments must be pointer variables. Pointer variable sameness is
6567// determined based on the equality of both type and value.
66- func Same (t TestingT , expected , actual interface {} , msgAndArgs ... interface {} ) bool {
68+ func Same [ A any , B any ] (t TestingT , expected A , actual B , msgAndArgs ... any ) bool {
6769 if h , ok := t .(tHelper ); ok {
6870 h .Helper ()
6971 }
@@ -76,7 +78,7 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b
7678//
7779// Both arguments must be pointer variables. Pointer variable sameness is
7880// determined based on the equality of both type and value.
79- func NotSame (t TestingT , expected , actual interface {} , msgAndArgs ... interface {} ) bool {
81+ func NotSame [ A any , B any ] (t TestingT , expected A , actual B , msgAndArgs ... any ) bool {
8082 if h , ok := t .(tHelper ); ok {
8183 h .Helper ()
8284 }
@@ -90,7 +92,7 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}
9092// assert.Contains(t, ["Hello", "World"], "World")
9193// assert.Contains(t, {"Hello": "World"}, "Hello")
9294//
93- func Contains (t TestingT , s , contains interface {} , msgAndArgs ... interface {} ) bool {
95+ func Contains [ A any , B any ] (t TestingT , s A , contains B , msgAndArgs ... any ) bool {
9496 if h , ok := t .(tHelper ); ok {
9597 h .Helper ()
9698 }
@@ -104,7 +106,7 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo
104106// assert.NotContains(t, ["Hello", "World"], "Earth")
105107// assert.NotContains(t, {"Hello": "World"}, "Earth")
106108//
107- func NotContains (t TestingT , s , contains interface {} , msgAndArgs ... interface {} ) bool {
109+ func NotContains [ A any , B any ] (t TestingT , s A , contains B , msgAndArgs ... any ) bool {
108110 if h , ok := t .(tHelper ); ok {
109111 h .Helper ()
110112 }
@@ -117,7 +119,7 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})
117119//
118120// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])
119121//
120- func ElementsMatch (t TestingT , listA , listB interface {} , msgAndArgs ... interface {} ) (ok bool ) {
122+ func ElementsMatch [ T any ] (t TestingT , listA , listB T , msgAndArgs ... any ) (ok bool ) {
121123 if h , ok := t .(tHelper ); ok {
122124 h .Helper ()
123125 }
@@ -128,7 +130,7 @@ func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface
128130//
129131// assert.Panics(t, func(){ GoCrazy() })
130132//
131- func Panics (t TestingT , f testifyAssert.PanicTestFunc , msgAndArgs ... interface {} ) bool {
133+ func Panics (t TestingT , f testifyAssert.PanicTestFunc , msgAndArgs ... any ) bool {
132134 if h , ok := t .(tHelper ); ok {
133135 h .Helper ()
134136 }
@@ -139,7 +141,7 @@ func Panics(t TestingT, f testifyAssert.PanicTestFunc, msgAndArgs ...interface{}
139141//
140142// assert.NotPanics(t, func(){ GoCrazy() })
141143//
142- func NotPanics (t TestingT , f testifyAssert.PanicTestFunc , msgAndArgs ... interface {} ) bool {
144+ func NotPanics (t TestingT , f testifyAssert.PanicTestFunc , msgAndArgs ... any ) bool {
143145 if h , ok := t .(tHelper ); ok {
144146 h .Helper ()
145147 }
@@ -150,7 +152,7 @@ func NotPanics(t TestingT, f testifyAssert.PanicTestFunc, msgAndArgs ...interfac
150152//
151153// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
152154//
153- func WithinDuration (t TestingT , expected , actual time.Time , delta time.Duration , msgAndArgs ... interface {} ) bool {
155+ func WithinDuration (t TestingT , expected , actual time.Time , delta time.Duration , msgAndArgs ... any ) bool {
154156 if h , ok := t .(tHelper ); ok {
155157 h .Helper ()
156158 }
@@ -164,7 +166,7 @@ func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration,
164166// assert.Equal(t, expectedObj, actualObj)
165167// }
166168//
167- func NoError (t TestingT , err error , msgAndArgs ... interface {} ) bool {
169+ func NoError (t TestingT , err error , msgAndArgs ... any ) bool {
168170 if h , ok := t .(tHelper ); ok {
169171 h .Helper ()
170172 }
@@ -178,7 +180,7 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
178180// assert.Equal(t, expectedObj, actualObj)
179181// }
180182//
181- func Error (t TestingT , err error , msgAndArgs ... interface {} ) bool {
183+ func Error (t TestingT , err error , msgAndArgs ... any ) bool {
182184 if h , ok := t .(tHelper ); ok {
183185 h .Helper ()
184186 }
@@ -191,7 +193,7 @@ func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
191193// actualObj, err := SomeFunction()
192194// assert.EqualError(t, err, expectedErrorString)
193195//
194- func EqualError (t TestingT , theError error , errString string , msgAndArgs ... interface {} ) bool {
196+ func EqualError (t TestingT , theError error , errString string , msgAndArgs ... any ) bool {
195197 if h , ok := t .(tHelper ); ok {
196198 h .Helper ()
197199 }
@@ -202,7 +204,7 @@ func EqualError(t TestingT, theError error, errString string, msgAndArgs ...inte
202204//
203205// assert.True(t, myBool)
204206//
205- func True (t TestingT , value bool , msgAndArgs ... interface {} ) bool {
207+ func True (t TestingT , value bool , msgAndArgs ... any ) bool {
206208 if h , ok := t .(tHelper ); ok {
207209 h .Helper ()
208210 }
@@ -213,7 +215,7 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool {
213215//
214216// assert.False(t, myBool)
215217//
216- func False (t TestingT , value bool , msgAndArgs ... interface {} ) bool {
218+ func False (t TestingT , value bool , msgAndArgs ... any ) bool {
217219 if h , ok := t .(tHelper ); ok {
218220 h .Helper ()
219221 }
@@ -224,7 +226,7 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) bool {
224226//
225227// assert.Nil(t, err)
226228//
227- func Nil (t TestingT , object interface {} , msgAndArgs ... interface {} ) bool {
229+ func Nil (t TestingT , object any , msgAndArgs ... any ) bool {
228230 if h , ok := t .(tHelper ); ok {
229231 h .Helper ()
230232 }
0 commit comments