8000 Make public the satisfyAnyOf and satisfyAllOf matchers that take arrays of matchers by younata · Pull Request #861 · Quick/Nimble · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make public the satisfyAnyOf and satisfyAllOf matchers that take arrays of matchers #861

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

Conversation

younata
Copy link
Member
@younata younata commented Feb 15, 2021

This will make it easier/possible to matchers that wrap satisfyAnyOf and satisfyAllOf.

Rationale of PR

In one of my projects, I have the pattern of the FakeCall<T> to test if callbacks were called and what the calls are. (gist of implementation from it, for reference. The relevant part is beCalled<T>(_ expectations: [FakeCallPredicate<T>]) -> Predicate<FakeCall<T>>). One of the matchers essentially takes an array of (KeyPath, Predicate)s and processes them to just an array of Predicates before passing them off to a copy-paste-edit of satisfyAllOf.

After the second time where I used a similar pattern (wrapping an array of predicates), I started to really wish that satisfyAllOf would be public, to better support this. I'm probably not the only one with this kind of idea, so I figure it would help others with this implementation.

I don't have a similar use-case for satisfyAnyOf, but it seemed like a good idea to give satisfyAnyOf the same treatment.

The PR should summarize what was changed and why. Here are some questions to
help you if you're not sure:

  • What behavior was changed?

  • What code was refactored / updated to support this change?

  • What issues are related to this PR? Or why was this change introduced?

  • Is this a new feature (Requires minor version bump)?

…ys of submatchers

This will make it easier/possible to matchers that wrap satisfyAnyOf and satisfyAllOf
@erudel
Copy link
erudel commented Apr 20, 2021

+1 for this change, since Swift currently doesn't support splatting exposing both APIs seems like the best workaround.

@ikesyo what are your thoughts 8000 on this?

Copy link
Member
@ikesyo ikesyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This totally makes sense 👍

Could you please add the doc comment?

younata and others added 2 commits April 25, 2021 12:32
Co-authored-by: IKEDA Sho <suicaicoca@gmail.com>
Co-authored-by: IKEDA Sho <suicaicoca@gmail.com>
@younata
Copy link
Member Author
younata commented Apr 25, 2021

@ikesyo Thanks for the review, done!

Copy link
Member
@ikesyo ikesyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

@ikesyo ikesyo merged commit d576c8c into Quick:master Apr 26, 2021
@younata younata deleted the make_internal_satisfyAllOf_and_satisfyAnyOf_matchers_public branch April 26, 2021 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0