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

Improve errors for test parameters #497

Merged
merged 1 commit into from
Aug 7, 2019

Conversation

ashawley
Copy link
Contributor

@ashawley ashawley commented Aug 7, 2019

Invalid test parameters, or mixing and matching test parameters that conflict raises an error, but it's not clear why. For example,

> jvm/testOnly org.scalacheck.util.PrettySpecification -- -n 200 -x 100
[error] Uncaught exception when running org.scalacheck.util.PrettySpecification: java.lang.IllegalArgumentException: Invalid test parameters
[error] sbt.ForkMain$ForkError: java.lang.IllegalArgumentException: Invalid test parameters
[error] 	at org.scalacheck.Test$.assertParams(Test.scala:225)
[error] 	at org.scalacheck.Test$.check(Test.scala:307)
[error] 	at org.scalacheck.ScalaCheckRunner$$anon$2.executeInternal(ScalaCheckFramework.scala:123)
[error] 	at org.scalacheck.ScalaCheckRunner$$anon$2.$anonfun$execute$11(ScalaCheckFramework.scala:113)
[error] 	at org.scalacheck.ScalaCheckRunner$$anon$2.$anonfun$execute$11$adapted(ScalaCheckFramework.scala:112)

This change would improve the diagnostics a bit. For the example above,

> jvm/testOnly org.scalacheck.util.PrettySpecification -- -n 200 -x 100
[error] Uncaught exception when running org.scalacheck.util.PrettySpecification: java.lang.IllegalArgumentException: Invalid test parameter: maxSize < minSize
[error] sbt.ForkMain$ForkError: java.lang.IllegalArgumentException: Invalid test parameter: maxSize < minSize
[error] 	at org.scalacheck.Test$.assertParams(Test.scala:225)
[error] 	at org.scalacheck.Test$.check(Test.scala:309)
[error] 	at org.scalacheck.ScalaCheckRunner$$anon$2.executeInternal(ScalaCheckFramework.scala:123)
[error] 	at org.scalacheck.ScalaCheckRunner$$anon$2.$anonfun$execute$11(ScalaCheckFramework.scala:113)
[error] 	at org.scalacheck.ScalaCheckRunner$$anon$2.$anonfun$execute$11$adapted(ScalaCheckFramework.scala:112)

@non
Copy link
Contributor

non commented Aug 7, 2019

This is a good idea!

Could you add interpolation to these? e.g.

Invalid test parameter: maxSize (10) < minSize (50)

@non
Copy link
Contributor

non commented Aug 7, 2019

Sorry I should have been clearer: I think it would be helpful if all of these messages interpolated the relevant parameters (so the author can see which value ended up getting used, not just the check that failed).

@non
Copy link
Contributor

non commented Aug 7, 2019

👍

@non non merged commit ce0e23e into typelevel:master Aug 7, 2019
@ashawley ashawley deleted the improve-param-errors branch August 8, 2019 13:11
@ashawley ashawley mentioned this pull request Aug 8, 2019
18 tasks
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.

2 participants