Errorf asserts that a function returned an error (i.e. not `nil`). actualObj, err := SomeFunction() if assert.Errorf(t, err, "error message %s", "formatted") { assert.Equal(t, expectedErrorf, err) }
(t TestingT, err error, msg string, args ...interface{})
| 379 | // assert.Equal(t, expectedErrorf, err) |
| 380 | // } |
| 381 | func Errorf(t TestingT, err error, msg string, args ...interface{}) { |
| 382 | if h, ok := t.(tHelper); ok { |
| 383 | h.Helper() |
| 384 | } |
| 385 | if assert.Errorf(t, err, msg, args...) { |
| 386 | return |
| 387 | } |
| 388 | t.FailNow() |
| 389 | } |
| 390 | |
| 391 | // Eventually asserts that given condition will be met in waitFor time, |
| 392 | // periodically checking target function each tick. |