Equal asserts exp == act. If they are not equal, it will fatal the test with a diff of the two objects. Errors will be compared with errors.Is.
(t testing.TB, name string, exp, act interface{}, opts ...cmp.Option)
| 23 | // |
| 24 | // Errors will be compared with errors.Is. |
| 25 | func Equal(t testing.TB, name string, exp, act interface{}, opts ...cmp.Option) { |
| 26 | slog.Helper() |
| 27 | |
| 28 | if diff := assert.Diff(exp, act, opts...); diff != "" { |
| 29 | slogtest.Fatal(t, "unexpected value", |
| 30 | slog.F("name", name), |
| 31 | slog.F("diff", diff), |
| 32 | ) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | // Success asserts err == nil. |
| 37 | func Success(t testing.TB, name string, err error) { |