File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 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
823823 - ` errors.Is(ACTUAL, EXPECTED) ` returns ` true `
824824 - ` ACTUAL ` or any of the errors it wraps (directly or indirectly) equals ` EXPECTED ` in terms of ` reflect.DeepEqual() ` .
825825
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.
827827
828828### Working with Channels
829829
Original file line number Diff line number Diff line change @@ -87,14 +87,17 @@ func Succeed() types.GomegaMatcher {
8787 return & matchers.SucceedMatcher {}
8888}
8989
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.
9192//
9293// These are valid use-cases:
9394//
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"
9698//
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
98101func MatchError (expected interface {}) types.GomegaMatcher {
99102 return & matchers.MatchErrorMatcher {
100103 Expected : expected ,
You can’t perform that action at this time.
0 commit comments