helpers.go 402 B

12345678910111213
  1. package testutil
  2. import (
  3. "github.com/stretchr/testify/assert"
  4. "github.com/stretchr/testify/require"
  5. )
  6. // ErrorContains checks that the error is not nil, and contains the expected
  7. // substring.
  8. func ErrorContains(t require.TestingT, err error, expectedError string, msgAndArgs ...interface{}) {
  9. require.Error(t, err, msgAndArgs...)
  10. assert.Contains(t, err.Error(), expectedError, msgAndArgs...)
  11. }