Added support for slice comparison
This commit is contained in:
parent
fe6204e8b5
commit
a7e65ca27f
2
Equal.go
2
Equal.go
@ -26,7 +26,7 @@ func NotEqual[T comparable](t testing.TB, a T, b T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeepEqual asserts that the two parameters are deeply equal.
|
// DeepEqual asserts that the two parameters are deeply equal.
|
||||||
func DeepEqual[T comparable](t testing.TB, a T, b T) {
|
func DeepEqual[T any](t testing.TB, a T, b T) {
|
||||||
if reflect.DeepEqual(a, b) {
|
if reflect.DeepEqual(a, b) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ func TestNotEqual(t *testing.T) {
|
|||||||
func TestDeepEqual(t *testing.T) {
|
func TestDeepEqual(t *testing.T) {
|
||||||
assert.DeepEqual(t, 0, 0)
|
assert.DeepEqual(t, 0, 0)
|
||||||
assert.DeepEqual(t, "Hello", "Hello")
|
assert.DeepEqual(t, "Hello", "Hello")
|
||||||
|
assert.DeepEqual(t, []byte("Hello"), []byte("Hello"))
|
||||||
assert.DeepEqual(t, T{A: 10}, T{A: 10})
|
assert.DeepEqual(t, T{A: 10}, T{A: 10})
|
||||||
assert.DeepEqual(t, &T{A: 10}, &T{A: 10})
|
assert.DeepEqual(t, &T{A: 10}, &T{A: 10})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user