scalacheck icon indicating copy to clipboard operation
scalacheck copied to clipboard

Properties no longer extends Prop; there is no straightforward way to check all of a Properties group pass

Open scr opened this issue 9 years ago • 4 comments

commit 3bec4b1e79f6afd07b8baa3fffa6ecc9acb7a061 removed Properties' subclassing of Prop. This means it's not possible to call check(myProperties).

calling check() on a properties object writes to stderr; doesn't return the result.

This makes it less useable for testing as it's not straightforward to check all properties from a test case.

scr avatar Aug 17 '16 14:08 scr

There's org.scalacheck.Test.checkProperties you can use for this. It's possible that it could be better documented.

rickynils avatar Aug 18 '16 17:08 rickynils

scalatest has a nice check() method - is there a nice way convert/wrap a Properties in a Prop that checks all properties in the group? What was the compelling reason to make Properties stop inheriting from Prop?

scr avatar Aug 19 '16 22:08 scr

I believe the change was made to satisfy ScalaJS compatibility.

Can you detail your use case a bit? Why is checkProperties not working out for you?

You can use Prop.all to combine several properties into one, and that was how Properties was converted to Prop before 3bec4b1e79f6afd07b8baa3fffa6ecc9acb7a061. You can use that method, but I fear property failures could be presented in a slightly confusing way.

rickynils avatar Aug 20 '16 06:08 rickynils

This was a frustrating issue when upgrading to scalatest 3.0 and scalacheck 1.13.x

@rickynils
def propertiesToProp(properties: Properties) = Prop.all(properties.properties.map(_._2): _*)

does work as a work around.

coltfred avatar Nov 12 '16 23:11 coltfred