package test
- Alphabetic
- By Inheritance
- test
- CompileVariants
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- package scalacheck
This package provides helpers to integrate *some* ScalaCheck primitives to their ZIO equivalents.
This package provides helpers to integrate *some* ScalaCheck primitives to their ZIO equivalents. Currently available helpers:
- Converting ScalaCheck Generators to ZIO Generators
- Asserting a ScalaCheck
Prop
with ZIO - Asserting a ScalaCheck
Properties
with ZIO
**Generators**
This functionality converts legacy ScalaCheck generators to ZIO Test generators to support upgrading to ZIO Test without having to reimplement existing generators. To use it import this module and then call
toGenZIO
on any existing ScalaCheck generator. For example:import org.scalacheck.Arbitrary import zio._ import zio.test._ import zio.test.scalacheck._ val anyInt: Gen[Any, Int] = Arbitrary.arbitrary[Int].toGenZIO
**Asserting ScalaCheck
Prop
andProperties
**This functionality generates ZIO Assertions from either ScalaCheck
Prop
orProperties
. This helps with integrating other libraries that provide ScalaCheck properties as helpers, i.e. cats-laws.Prop
example:import org.scalacheck.Prop import org.scalacheck.Test.{ Parameters => ScalaCheckParameters } import zio._ import zio.test._ import zio.test.scalacheck._ val prop: Prop = Prop.forAll { (n: Int, m: Int) => n + m == m + n } val resultDefault: TestResult = prop.assertZIO() val resultWithCustomizations: TestResult = prop.assertZIO("My Prop Name", ScalaCheckParameters.default.withMaxSize(10))
Properties
example:import org.scalacheck.{ Prop, Properties } import org.scalacheck.Test.{ Parameters => ScalaCheckParameters } import zio._ import zio.test._ import zio.test.scalacheck._ object MyProperties extends Properties("MyProperties") { property("myProp") = Prop.forAll { (n: Int, m: Int) => n + m == m + n } } * val resultDefault: TestResult = MyProperties.assertZIO() // Beware that we can't provide a custom name here, it will be // taken from the `Properties` name parameter val resultWithCustomizations: TestResult = MyProperties.assertZIO(ScalaCheckParameters.default.withMaxSize(10))
Type Members
Value Members
- def annotations(implicit trace: Trace): UIO[Annotations]
- def annotationsWith[R, E, A](f: (Annotations) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- macro def assert[A](expr: => A)(assertion: Assertion[A]): TestResult
- Definition Classes
- CompileVariants
- def assertCompletes(implicit trace: Trace, sourceLocation: SourceLocation): TestResult
- def assertCompletesZIO(implicit trace: Trace, sourceLocation: SourceLocation): UIO[TestResult]
- def assertNever(message: String)(implicit trace: Trace, sourceLocation: SourceLocation): TestResult
- macro def assertTrue(expr: Boolean): TestResult
- Definition Classes
- CompileVariants
- macro def assertTrue(expr: Boolean, exprs: Boolean*): TestResult
- Definition Classes
- CompileVariants
- def assertZIO[R, E, A](effect: ZIO[R, E, A])(assertion: Assertion[A])(implicit trace: Trace, sourceLocation: SourceLocation): ZIO[R, E, TestResult]
- Definition Classes
- CompileVariants
- def check[R <: ZAny, A, B, C, D, F, G, H, I, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], rv8: Gen[R, I])(test: (A, B, C, D, F, G, H, I) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def check[R <: ZAny, A, B, C, D, F, G, H, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H])(test: (A, B, C, D, F, G, H) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def check[R <: ZAny, A, B, C, D, F, G, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G])(test: (A, B, C, D, F, G) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def check[R <: ZAny, A, B, C, D, F, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F])(test: (A, B, C, D, F) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def check[R <: ZAny, A, B, C, D, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D])(test: (A, B, C, D) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def check[R <: ZAny, A, B, C, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C])(test: (A, B, C) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def check[R <: ZAny, A, B, In](rv1: Gen[R, A], rv2: Gen[R, B])(test: (A, B) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def check[R <: ZAny, A, In](rv: Gen[R, A])(test: (A) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAll[R <: ZAny, E, A, B, C, D, F, G, H, I, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], rv8: Gen[R, I])(test: (A, B, C, D, F, G, H, I) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAll[R <: ZAny, A, B, C, D, F, G, H, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H])(test: (A, B, C, D, F, G, H) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAll[R <: ZAny, A, B, C, D, F, G, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G])(test: (A, B, C, D, F, G) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAll[R <: ZAny, A, B, C, D, F, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F])(test: (A, B, C, D, F) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAll[R <: ZAny, A, B, C, D, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D])(test: (A, B, C, D) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAll[R <: ZAny, A, B, C, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C])(test: (A, B, C) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAll[R <: ZAny, A, B, In](rv1: Gen[R, A], rv2: Gen[R, B])(test: (A, B) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAll[R <: ZAny, A, In](rv: Gen[R, A])(test: (A) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAllPar[R <: ZAny, E, A, B, C, D, F, G, H, I, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], rv8: Gen[R, I], parallelism: Int)(test: (A, B, C, D, F, G, H, I) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAllPar[R <: ZAny, E, A, B, C, D, F, G, H, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], parallelism: Int)(test: (A, B, C, D, F, G, H) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAllPar[R <: ZAny, E, A, B, C, D, F, G, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], parallelism: Int)(test: (A, B, C, D, F, G) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAllPar[R <: ZAny, E, A, B, C, D, F, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], parallelism: Int)(test: (A, B, C, D, F) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAllPar[R <: ZAny, E, A, B, C, D, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], parallelism: Int)(test: (A, B, C, D) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAllPar[R <: ZAny, E, A, B, C, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], parallelism: Int)(test: (A, B, C) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAllPar[R <: ZAny, E, A, B, In](rv1: Gen[R, A], rv2: Gen[R, B], parallelism: Int)(test: (A, B) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkAllPar[R <: ZAny, E, A, In](rv: Gen[R, A], parallelism: Int)(test: (A) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkN(n: Int): CheckN
- def checkPar[R <: ZAny, A, B, C, D, F, G, H, I, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], rv8: Gen[R, I], parallelism: Int)(test: (A, B, C, D, F, G, H, I) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkPar[R <: ZAny, A, B, C, D, F, G, H, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], parallelism: Int)(test: (A, B, C, D, F, G, H) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkPar[R <: ZAny, A, B, C, D, F, G, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], parallelism: Int)(test: (A, B, C, D, F, G) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkPar[R <: ZAny, A, B, C, D, F, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], parallelism: Int)(test: (A, B, C, D, F) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkPar[R <: ZAny, A, B, C, D, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], parallelism: Int)(test: (A, B, C, D) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkPar[R <: ZAny, A, B, C, In](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], parallelism: Int)(test: (A, B, C) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkPar[R <: ZAny, A, B, In](rv1: Gen[R, A], rv2: Gen[R, B], parallelism: Int)(test: (A, B) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- def checkPar[R <: ZAny, A, In](rv: Gen[R, A], parallelism: Int)(test: (A) => In)(implicit checkConstructor: CheckConstructor[R, In], sourceLocation: SourceLocation, trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
- lazy val defaultTestRunner: TestRunner[TestEnvironment, Any]
- def failed[E](cause: Cause[E])(implicit trace: Trace): ZIO[Any, TestFailure[E], Nothing]
- val ignored: UIO[TestSuccess]
- def live(implicit trace: Trace): UIO[Live]
- def live[R, E, A](zio: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- val liveEnvironment: Layer[Nothing, Clock with Console with System with Random]
- def liveWith[R, E, A](f: (Live) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- def platformSpecific[R, E, A](js: => A, jvm: => A)(f: (A) => ZTest[R, E]): ZTest[R, E]
- def sized(implicit trace: Trace): UIO[Sized]
- def sizedWith[R, E, A](f: (Sized) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- def suite[In](label: String)(specs: In*)(implicit suiteConstructor: SuiteConstructor[In], sourceLocation: SourceLocation, trace: Trace): Spec[OutEnvironment, OutError]
- def test[In](label: String)(assertion: => In)(implicit testConstructor: TestConstructor[Nothing, In], sourceLocation: SourceLocation, trace: Trace): Out
- def testClock(implicit trace: Trace): UIO[TestClock]
- def testClockWith[R, E, A](f: (TestClock) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- def testConfig(implicit trace: Trace): UIO[TestConfig]
- def testConfigWith[R, E, A](f: (TestConfig) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- def testConsole(implicit trace: Trace): UIO[TestConsole]
- def testConsoleWith[R, E, A](f: (TestConsole) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- val testEnvironment: ZLayer[Any, Nothing, TestEnvironment]
- def testRandom(implicit trace: Trace): UIO[TestRandom]
- def testRandomWith[R, E, A](f: (TestRandom) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- def testSystem(implicit trace: Trace): UIO[TestSystem]
- def testSystemWith[R, E, A](f: (TestSystem) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- final macro def typeCheck(code: String): UIO[Either[String, Unit]]
- Definition Classes
- CompileVariants
- def versionSpecific[R, E, A](scala3: => A, scala2: => A)(f: (A) => ZTest[R, E]): ZTest[R, E]
- def withAnnotations[R, E, A <: Annotations, B](annotations: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]
- def withAnnotationsScoped[A <: Annotations](annotations: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]
- def withLive[R, E, E1, A, B](zio: ZIO[R, E, A])(f: (ZIO[R, E, A]) => ZIO[R, E1, B])(implicit trace: Trace): ZIO[R, E1, B]
- def withLive[R, E, A <: Live, B](live: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]
- def withLiveScoped[A <: Live](live: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]
- def withSized[R, E, A <: Sized, B](sized: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]
- def withSizedScoped[A <: Sized](sized: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]
- def withTestConfig[R, E, A <: TestConfig, B](testConfig: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]
- def withTestConfigScoped[A <: TestConfig](testConfig: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]