Open terdong opened 2 years ago
Hello! Unfortunately, there is no seamless integration of munit-zio-scalacheck right now. А rough way to achieve a goal:
import zio._
import munit.ScalaCheckSuite
import org.scalacheck.Prop._
class ScalaCheckSpec extends ZSuite with ScalaCheckSuite {
property("integer identities") {
forAll { (n: Int) =>
val computation = ZIO(n + 0)
val result = assertEqualsZ(computation, n)
Runtime.default.unsafeRun(result)
}
}
}
I think that it's a good improvement opportunity: create ZScalaCheckSuite based on ScalaCheckSuite with patched runtime integration. In my mind syntax should be like
property("integer identities") {
forAllZ { (n: Int) => // def forAllZ[E](body: IO[E, Any])(implicit loc: Location): Prop <- runs body on ZRuntime and passes it to the ordinary forAll
val computation = ZIO(n + 0)
assertEqualsZ(computation, n)
}
}
Of course it should be dedicated library module munit-zio-scalacheck
to avoid scalacheck in the dependencies of original munit-zio.
Any updates on it?
I don't use property-based tests myself, so this is not priority task for me. But contributions are welcome, I'll be glad to review some PRs :)
First of all, thank you for your service in integrating zio and munit.
ZIO supports the check method, and munit provides it using scalacheck. I've tried both again, but it doesn't work for now. Is there any other way?