-
Notifications
You must be signed in to change notification settings - Fork 57
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
Cats typeclass instances for ArgumentMatcher. #255
Cats typeclass instances for ArgumentMatcher. #255
Conversation
9db3379
to
84b93d3
Compare
implicit def arbArgumentMatcher[A](implicit a: Arbitrary[A => Boolean]): Arbitrary[ArgumentMatcher[A]] = | ||
Arbitrary(a.arbitrary.map(p => new ArgumentMatcher[A] { def matches(a: A) = p(a) })) | ||
|
||
checkAll("ArgumentMatcher[MiniInt]", ContravariantMonoidalTests[ArgumentMatcher].contravariantMonoidal[MiniInt, MiniInt, MiniInt]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to also have tests that show how to use these, and that will also prove that the macro is not messing up with them.
We can even fix the macro so we can add a specific call for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be just adding one or more strings to org.mockito.Utils.MockitoMatchers
:)
in case they have symbolic syntax (ie *>
or whatever) look at like 48 for an examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think stuff like this actually lessens the need for macro support, because the more convenient it is to combine and transform matchers, the less of a hassle it is to add in an argThat
once done. I'll write up some example tests as suggested to test this theory though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, the less we rely on macros, the better :)
cc9df38
to
28c2b65
Compare
It looks like there is an issue with Scala 2.11 This is the output from CI, to test this locally you can run
|
No description provided.