MCPcopy
hub / github.com/stretchr/testify / TestErrorContainsWrapper

Function TestErrorContainsWrapper

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

Source from the content-addressed store, hash-verified

346}
347
348func TestErrorContainsWrapper(t *testing.T) {
349 t.Parallel()
350
351 assert := New(t)
352 mockAssert := New(new(testing.T))
353
354 // start with a nil error
355 var err error
356 assert.False(mockAssert.ErrorContains(err, ""),
357 "ErrorContains should return false for nil arg")
358
359 // now set an error
360 err = errors.New("some error: another error")
361 assert.False(mockAssert.ErrorContains(err, "different error"),
362 "ErrorContains should return false for different error string")
363 assert.True(mockAssert.ErrorContains(err, "some error"),
364 "ErrorContains should return true")
365 assert.True(mockAssert.ErrorContains(err, "another error"),
366 "ErrorContains should return true")
367}
368
369func TestEqualErrorWrapper(t *testing.T) {
370 t.Parallel()

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