-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Tests: MonadCombine->Alternative, add missing ones #2037
Tests: MonadCombine->Alternative, add missing ones #2037
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2037 +/- ##
======================================
Coverage 95% 95%
======================================
Files 311 311
Lines 5266 5266
Branches 131 131
======================================
Hits 5003 5003
Misses 263 263 Continue to review full report at Codecov.
|
I guess they're technically went through here. |
@@ -2,6 +2,14 @@ package cats | |||
package tests | |||
|
|||
class MonadCombineSuite extends CatsSuite { |
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.
How about renaming the class as well? :)
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.
Oops, nice catch!
|
||
test("guard") { | ||
forAll { (b: Boolean) => | ||
Alternative[Option].guard(b).isDefined should === (b) |
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.
This test case will probably run 100 times, but only two values are actually tested. I'd rather generate different valid Alternative
instances.
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'm not sure how to do that with forall
. Do you have an example testcase I can look into and copy the behavior of?
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.
You don’t need forall. Just write a def for the law, then call it for two inputs.
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.
Thanks for the improved tests.
|
||
test("guard") { | ||
forAll { (b: Boolean) => | ||
Alternative[Option].guard(b).isDefined should === (b) |
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.
You don’t need forall. Just write a def for the law, then call it for two inputs.
3a4734e
to
9a7024a
Compare
Pushed this version. I can add more tests that work the way @LukaJCB wanted if someone can give me some pointers :). |
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.
Thanks!
Thanks! |
Wrt
guard
test... This one doesn't seem amazing, but I wasn't too sure what else to test.