NoErrorf asserts that a function returned no error (i.e. `nil`). actualObj, err := SomeFunction() if assert.NoErrorf(t, err, "error message %s", "formatted") { assert.Equal(t, expectedObj, actualObj) }
(t TestingT, err error, msg string, args ...interface{})
| 1365 | // assert.Equal(t, expectedObj, actualObj) |
| 1366 | // } |
| 1367 | func NoErrorf(t TestingT, err error, msg string, args ...interface{}) { |
| 1368 | if h, ok := t.(tHelper); ok { |
| 1369 | h.Helper() |
| 1370 | } |
| 1371 | if assert.NoErrorf(t, err, msg, args...) { |
| 1372 | return |
| 1373 | } |
| 1374 | t.FailNow() |
| 1375 | } |
| 1376 | |
| 1377 | // NoFileExists checks whether a file does not exist in a given path. It fails |
| 1378 | // if the path points to an existing _file_ only. |