MCPcopy Create free account
hub / github.com/stretchr/testify / TestErrorContainsWrapper

Function TestErrorContainsWrapper

assert/forward_assertions_test.go:318–335  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

316}
317
318func TestErrorContainsWrapper(t *testing.T) {
319 assert := New(t)
320 mockAssert := New(new(testing.T))
321
322 // start with a nil error
323 var err error
324 assert.False(mockAssert.ErrorContains(err, ""),
325 "ErrorContains should return false for nil arg")
326
327 // now set an error
328 err = errors.New("some error: another error")
329 assert.False(mockAssert.ErrorContains(err, "different error"),
330 "ErrorContains should return false for different error string")
331 assert.True(mockAssert.ErrorContains(err, "some error"),
332 "ErrorContains should return true")
333 assert.True(mockAssert.ErrorContains(err, "another error"),
334 "ErrorContains should return true")
335}
336
337func TestEqualErrorWrapper(t *testing.T) {
338 assert := New(t)

Callers

nothing calls this directly

Calls 4

NewFunction · 0.70
FalseMethod · 0.45
ErrorContainsMethod · 0.45
TrueMethod · 0.45

Tested by

no test coverage detected