Skip to content
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

Fix Arbitrary instances in Free tests for ScalaCheck 1.13.3 #1451

Merged
merged 1 commit into from
Nov 5, 2016

Conversation

travisbrown
Copy link
Contributor

A couple of weeks ago I noticed that updating to ScalaCheck 1.13.3 was causing weird ScalaTest errors. I "fixed" this by not updating to ScalaCheck 1.13.3.

Staying on 1.13.2 is no longer an option now that we're updating to 2.12.0, and I've confirmed that the same thing happens with 1.13.4 and 2.12.0.

The problem isn't actually ScalaTest calling getSimpleName—that's just making the error message uselessly obscure. Instead the problem seems to be some new bounds checking for Gen.Choose that was introduced in ScalaCheck 1.13.3. This PR fixes the issue by ensuring we don't call Gen.chooseNum with min = 1 and max = 0.

This seems sensible but someone whose familiar with the logic of these Arbitrary instances should confirm that it doesn't mess things up.

Note that we can't update to 1.13.4 yet, since that's not published for 2.12.0-RC2. This PR will make that possible once Catalysts is ready, though.

@non
Copy link
Contributor

non commented Nov 4, 2016

This looks good to me. (And the bounds-checking exceptions were exactly to help people identify these issues, although it sounds like that experience wasn't fantastic.) 👍

@travisbrown
Copy link
Contributor Author

@non Well, the unpleasantness was entirely ScalaTest's fault… 😄

@codecov-io
Copy link

codecov-io commented Nov 4, 2016

Current coverage is 92.19% (diff: 100%)

Merging #1451 into master will not change coverage

@@             master      #1451   diff @@
==========================================
  Files           242        242          
  Lines          3615       3615          
  Methods        3546       3543     -3   
  Messages          0          0          
  Branches         69         72     +3   
==========================================
  Hits           3333       3333          
  Misses          282        282          
  Partials          0          0          

Powered by Codecov. Last update bcc751f...3cd666a

@adelbertc
Copy link
Contributor

👍

@non non merged commit 2fd55c5 into typelevel:master Nov 5, 2016
@non non removed the in progress label Nov 5, 2016
@ceedubs
Copy link
Contributor

ceedubs commented Nov 8, 2016

Thanks @travisbrown! I'm pretty sure that I introduced these bad generators.

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.

5 participants