Skip to content

Instantly share code, notes, and snippets.

@arosien
Last active August 29, 2015 14:01
Show Gist options
  • Save arosien/3aa1faf2953e86ebdc2f to your computer and use it in GitHub Desktop.
Save arosien/3aa1faf2953e86ebdc2f to your computer and use it in GitHub Desktop.
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