internal/assert/assert.go
raw| 1 | package assert |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/google/go-cmp/cmp" |
| 7 | ) |
| 8 | |
| 9 | func Equal(t *testing.T, x, y any) { |
| 10 | t.Helper() |
| 11 | |
| 12 | r := DiffReporter{} |
| 13 | if !cmp.Equal(x, y, cmp.Reporter(&r)) { |
| 14 | t.Error(r.String()) |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | func Nil(t *testing.T, x any) { |
| 19 | t.Helper() |
| 20 | |
| 21 | Equal(t, x, nil) |
| 22 | } |