File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -823,7 +823,7 @@ succeeds if `ACTUAL` is a non-nil `error` that matches `EXPECTED`. `EXPECTED` mu
823
823
- ` errors.Is(ACTUAL, EXPECTED) ` returns ` true `
824
824
- ` ACTUAL ` or any of the errors it wraps (directly or indirectly) equals ` EXPECTED ` in terms of ` reflect.DeepEqual() ` .
825
825
826
- Any other type for ` EXPECTED ` is an error.
826
+ Any other type for ` EXPECTED ` is an error. It is also an error for ` ACTUAL ` to be nil.
827
827
828
828
### Working with Channels
829
829
Original file line number Diff line number Diff line change @@ -87,14 +87,17 @@ func Succeed() types.GomegaMatcher {
87
87
return & matchers.SucceedMatcher {}
88
88
}
89
89
90
- // MatchError succeeds if actual is a non-nil error that matches the passed in string/error.
90
+ // MatchError succeeds if actual is a non-nil error that matches the passed in
91
+ // string, error, or matcher.
91
92
//
92
93
// These are valid use-cases:
93
94
//
94
- // Expect(err).Should(MatchError("an error")) //asserts that err.Error() == "an error"
95
- // Expect(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual)
95
+ // Expect(err).Should(MatchError("an error")) //asserts that err.Error() == "an error"
96
+ // Expect(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual)
97
+ // Expect(err).Should(MatchError(ContainsSubstring("sprocket not found"))) // asserts that edrr.Error() contains substring "sprocket not found"
96
98
//
97
- // It is an error for err to be nil or an object that does not implement the Error interface
99
+ // It is an error for err to be nil or an object that does not implement the
100
+ // Error interface
98
101
func MatchError (expected interface {}) types.GomegaMatcher {
99
102
return & matchers.MatchErrorMatcher {
100
103
Expected : expected ,
You can’t perform that action at this time.
0 commit comments