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

Function TestErrorContains

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

Source from the content-addressed store, hash-verified

1639}
1640
1641func TestErrorContains(t *testing.T) {
1642 mockT := new(testing.T)
1643
1644 // start with a nil error
1645 var err error
1646 False(t, ErrorContains(mockT, err, ""),
1647 "ErrorContains should return false for nil arg")
1648
1649 // now set an error
1650 err = errors.New("some error: another error")
1651 False(t, ErrorContains(mockT, err, "bad error"),
1652 "ErrorContains should return false for different error string")
1653 True(t, ErrorContains(mockT, err, "some error"),
1654 "ErrorContains should return true")
1655 True(t, ErrorContains(mockT, err, "another error"),
1656 "ErrorContains should return true")
1657}
1658
1659func Test_isEmpty(t *testing.T) {
1660

Callers

nothing calls this directly

Calls 3

FalseFunction · 0.70
ErrorContainsFunction · 0.70
TrueFunction · 0.70

Tested by

no test coverage detected