Quick / Nimble

A Matcher Framework for Swift and Objective-C
https://quick.github.io/Nimble/documentation/nimble/
Apache License 2.0
4.79k stars 595 forks source link

Add matchers for Result that match against submatchers, or for equatable values. #1134

Closed younata closed 3 months ago

younata commented 3 months ago

I find that the current matchers for Result, where you must pass in a closure to be checked against the success/failure values, to be rather cumbersome. I'd much rather pass in another matcher to do this check. I find that it reads much easier.

To that end, I added beSuccess that takes in a matcher, and beFailure that takes in a matcher.

For additional ease of use, I also added beSuccess that takes in an Equatable value, for when the success value is Equatable itself. This is similar to using beSuccess(equal(someValue)), but it also slightly improves the error message in that case.

New feature: Minor version bump required!