aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/stretchr/testify/require/require_forward.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-03-18 12:46:38 +0100
committerGitHub <noreply@github.com>2022-03-18 12:46:38 +0100
commite471bf532c751c4f775d8d9f5f8bba35104acbb5 (patch)
tree9fcd93496d1d479f188f67545ba9dd1dca1be09e /vendor/github.com/stretchr/testify/require/require_forward.go
parente00e06de9ab8c9c26b4248f673db09bf3667917c (diff)
parentc732adf2d0a243a829798226c75447e235f88aa6 (diff)
downloadpodman-e471bf532c751c4f775d8d9f5f8bba35104acbb5.tar.gz
podman-e471bf532c751c4f775d8d9f5f8bba35104acbb5.tar.bz2
podman-e471bf532c751c4f775d8d9f5f8bba35104acbb5.zip
Merge pull request #13528 from containers/dependabot/go_modules/github.com/stretchr/testify-1.7.1
build(deps): bump github.com/stretchr/testify from 1.7.0 to 1.7.1
Diffstat (limited to 'vendor/github.com/stretchr/testify/require/require_forward.go')
-rw-r--r--vendor/github.com/stretchr/testify/require/require_forward.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go
index ed54a9d83..5bb07c89c 100644
--- a/vendor/github.com/stretchr/testify/require/require_forward.go
+++ b/vendor/github.com/stretchr/testify/require/require_forward.go
@@ -223,6 +223,30 @@ func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ..
ErrorAsf(a.t, err, target, msg, args...)
}
+// ErrorContains asserts that a function returned an error (i.e. not `nil`)
+// and that the error contains the specified substring.
+//
+// actualObj, err := SomeFunction()
+// a.ErrorContains(err, expectedErrorSubString)
+func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) {
+ if h, ok := a.t.(tHelper); ok {
+ h.Helper()
+ }
+ ErrorContains(a.t, theError, contains, msgAndArgs...)
+}
+
+// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
+// and that the error contains the specified substring.
+//
+// actualObj, err := SomeFunction()
+// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")
+func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) {
+ if h, ok := a.t.(tHelper); ok {
+ h.Helper()
+ }
+ ErrorContainsf(a.t, theError, contains, msg, args...)
+}
+
// ErrorIs asserts that at least one of the errors in err's chain matches target.
// This is a wrapper for errors.Is.
func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) {