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

Function TestErrorContains

assert/assertions_test.go:1714–1732  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1712}
1713
1714func TestErrorContains(t *testing.T) {
1715 t.Parallel()
1716
1717 mockT := new(testing.T)
1718
1719 // start with a nil error
1720 var err error
1721 False(t, ErrorContains(mockT, err, ""),
1722 "ErrorContains should return false for nil arg")
1723
1724 // now set an error
1725 err = errors.New("some error: another error")
1726 False(t, ErrorContains(mockT, err, "bad error"),
1727 "ErrorContains should return false for different error string")
1728 True(t, ErrorContains(mockT, err, "some error"),
1729 "ErrorContains should return true")
1730 True(t, ErrorContains(mockT, err, "another error"),
1731 "ErrorContains should return true")
1732}
1733
1734func Test_isEmpty(t *testing.T) {
1735 t.Parallel()

Callers

nothing calls this directly

Calls 3

FalseFunction · 0.70
ErrorContainsFunction · 0.70
TrueFunction · 0.70

Tested by

no test coverage detected