Conversation
|
I'd love to get community feedback on this. I'm not sure the value this extra function adds is greater than the confusion/complexity it creates by having yet another function in the In fact, how is this different from the |
|
|
|
I see. Would it not make sense to rename this function to |
Semantically I'm asserting that the Error
I'd written |
|
Fair point, that makes sense :) |
|
This was merged 6 months ago but still unavailable in |
|
1.7.1 is realeased and seems to include this feature. Thank you everyone. |
Summary
It's common practice to wrap errors, so that you do not have a transitive dependency on the error format of a third party library, but also so that you are able to exactly match you are testing a specific error case correctly.
This change adds an
ErrorContains()method to check that both an error is reurned, and it contains a provided string.Changes
Added
ErrorContains()andErrorContainsf().Motivation
When I wrap errors returned from third party modules:
This then forces me to write:
This change removes the
requireandError()unpacking:Related issues