-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A matcher that matches at least one of the given matchers #58
Comments
Hey @favonia, I think this makes sense as a nice addition to the library. I think |
favonia
changed the title
A
A matcher that matches at least one of the given matchers
Aug 15, 2023
Some
matcher that matches at least one of the given matchers
@JacobOaks Done. Any other suggestions before I make a PR? |
@favonia awesome, nope - go ahead and thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requested feature
A new matcher combinator like
All
but returns true when one of the matchers returns true.Why the feature is needed
We currently have
All
that matches all the matchers, just like the universal quantifier in the logic. It would be great to haveAnyOf
that matches at least one of them, similar to the existential quantifier in the logic. This is helpful when an argument can be one of several values. For example, with the newAnyOf
matcher, we may write the following:This means we expect a method call
SetDirection("north", true)
,SetDirection("south", true)
,SetDirection("west", true)
orSetDirection("east", true)
, which is then followed by a method callRun()
.(Optional) Proposed solution
Here is a sample implementation. It's trivial for me to make a PR if the maintainers feel positive about this feature.
Related issues and PRs (from the original gomock)
The text was updated successfully, but these errors were encountered: