ErrorContains asserts that a function returned an error (i.e. not `nil`) and that the error contains the specified substring. actualObj, err := SomeFunction() assert.ErrorContains(t, err, expectedErrorSubString)
(t TestingT, theError error, contains string, msgAndArgs ...interface{})
| 324 | // actualObj, err := SomeFunction() |
| 325 | // assert.ErrorContains(t, err, expectedErrorSubString) |
| 326 | func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) { |
| 327 | if h, ok := t.(tHelper); ok { |
| 328 | h.Helper() |
| 329 | } |
| 330 | if assert.ErrorContains(t, theError, contains, msgAndArgs...) { |
| 331 | return |
| 332 | } |
| 333 | t.FailNow() |
| 334 | } |
| 335 | |
| 336 | // ErrorContainsf asserts that a function returned an error (i.e. not `nil`) |
| 337 | // and that the error contains the specified substring. |
searching dependent graphs…