Last active
August 29, 2015 14:01
-
-
Save arosien/3aa1faf2953e86ebdc2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.scalacheck._ | |
| import org.scalacheck.Arbitrary._ | |
| import scalaz.scalacheck.ScalazProperties._ | |
| object FooSpec extends Properties("Foo") { | |
| class Foo(value: String) | |
| implicit val FooEqual: Equal[Foo] = Equal.equalRef | |
| implicit val FooArb: Arbitrary[Foo] = Arbitrary(Gen.identifier map (new Foo(_))) | |
| checkAll(equal.laws[Foo]) // passes | |
| property("eq") = Equal[Foo].equal(new Foo("foo"), new Foo("foo")) // fails! | |
| def checkAll(props: Properties) { | |
| for ((name, prop) <- props.properties) yield { | |
| property(name) = prop | |
| } | |
| } | |
| } | |
| FooSpec.check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment