From 140c5214fe0885c5d0420e79bb205e91f6c9e334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C5=A0pan=C4=9Bl?= Date: Wed, 15 Mar 2023 10:45:02 +0100 Subject: [PATCH] Effects working, not propagating failures See https://github.com/typelevel/scalacheck-effect/issues/261 --- src/test/scala/MainTest.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/scala/MainTest.scala b/src/test/scala/MainTest.scala index 2f62bdc..ab32759 100644 --- a/src/test/scala/MainTest.scala +++ b/src/test/scala/MainTest.scala @@ -1,8 +1,11 @@ import org.scalatest.flatspec.AsyncFlatSpec import org.scalatest.matchers.should.Matchers import org.scalacheck._ +import org.scalacheck.effect.PropF import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks +import scala.concurrent.Future + class MainTest extends AsyncFlatSpec with Matchers with ScalaCheckPropertyChecks { behavior of "Main" @@ -11,4 +14,16 @@ class MainTest extends AsyncFlatSpec with Matchers with ScalaCheckPropertyChecks assert(i < 5) // intentional fail - we want to see how the failure is reported } } + + it should "perform async computations" in { + + PropF.forAllF(Gen.oneOf(0 until 10)) { i => + Future { + assert(i < 5) // intentional fail - we want to see how the failure is reported + }.map(_ => ()) // forAllF supports Future[Unit] by default, so we need to throw away the Assertion value + }.check().map { r => + assert(r.passed) // works, but does not propagate the test result + } + } + }