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{})
| 108 | // assert.Equal(t, expectedErrorf, err) |
| 109 | // } |
| 110 | func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { |
| 111 | if h, ok := t.(tHelper); ok { |
| 112 | h.Helper() |
| 113 | } |
| 114 | return Error(t, err, append([]interface{}{msg}, args...)...) |
| 115 | } |
| 116 | |
| 117 | // Eventuallyf asserts that given condition will be met in waitFor time, |
| 118 | // periodically checking target function each tick. |