-
Notifications
You must be signed in to change notification settings - Fork 15
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
More matchers #34
Comments
custom closure was added: |
It's unclear to me from the docs how to use custom matcher, particularly the any() matcher. I have the following method: I care about matching A, but not B or C (which are the results of hashing and random number generation respectively). I have tried this: But this generates multiple errors:
If these matchers cannot be inlined inside |
Ah! I tried explaining that in the docs but it looks like it was either confusing or hard to find. For your specific use case, to ignore arguments you can use In the general case, argument matchers are either:
Let me know how could I have worded or organized the docs better to make this information more accessible. |
Ah. I was scouring the Matcher page and all its structs, traits, and functions. I think a mention on any one of them that the when macro encodes them differently would be enough, with a link to when's documentation would suffice. |
Good call, I'll be explicit about the |
@mbuscemi I have updated the docs to hopefully make it more clear for the future: https://docs.rs/faux/0.1.3/faux/matcher/fn.any.html |
The only implemented matchers at the moment are:
Any
: matches any argumentEq
matches based onArg: PartialEq
EqAgainst
matches based onArg: PartialEq<Against>
We could implement other matchers so
faux
users don't have to handwrite their own matchers.Quick ideas:
<
<=
>
>=
!
||
&&
custom closure. Unsure if this is all that much better than a just implementingArgMatcher
though.We can first decide what matchers to create and then see if
when!
can come up with an easy to use syntax for it.cc: @muscovite
The text was updated successfully, but these errors were encountered: