Packages

  • package root
    Definition Classes
    root
  • package zio
    Definition Classes
    root
  • package test
    Definition Classes
    zio
  • 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 and Properties**

    This functionality generates ZIO Assertions from either ScalaCheck Prop or Properties. 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))
p

zio

test

package test

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. test
  2. CompileVariants
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. 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 and Properties**

    This functionality generates ZIO Assertions from either ScalaCheck Prop or Properties. 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

  1. type TestAspectAtLeastR[-R] = TestAspect[Nothing, R, Nothing, Any]
  2. type TestAspectPoly = TestAspect[Nothing, Any, Nothing, Any]
  3. type TestEnvironment = Annotations with Live with Sized with TestConfig
  4. type ZTest[-R, +E] = ZIO[R, TestFailure[E], TestSuccess]

Value Members

  1. def annotations(implicit trace: Trace): UIO[Annotations]
  2. def annotationsWith[R, E, A](f: (Annotations) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
  3. macro def assert[A](expr: => A)(assertion: Assertion[A]): TestResult
    Definition Classes
    CompileVariants
  4. def assertCompletes(implicit trace: Trace, sourceLocation: SourceLocation): TestResult
  5. def assertCompletesZIO(implicit trace: Trace, sourceLocation: SourceLocation): UIO[TestResult]
  6. def assertNever(message: String)(implicit trace: Trace, sourceLocation: SourceLocation): TestResult
  7. macro def assertTrue(expr: Boolean): TestResult
    Definition Classes
    CompileVariants
  8. macro def assertTrue(expr: Boolean, exprs: Boolean*): TestResult
    Definition Classes
    CompileVariants
  9. 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
  10. 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]
  11. 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]
  12. 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]
  13. 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]
  14. 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]
  15. 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]
  16. 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]
  17. 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]
  18. 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]
  19. 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]
  20. 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]
  21. 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]
  22. 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]
  23. 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]
  24. 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]
  25. 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]
  26. 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]
  27. 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]
  28. 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]
  29. 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]
  30. 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]
  31. 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]
  32. 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]
  33. 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]
  34. def checkN(n: Int): CheckN
  35. 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]
  36. 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]
  37. 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]
  38. 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]
  39. 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]
  40. 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]
  41. 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]
  42. 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]
  43. lazy val defaultTestRunner: TestRunner[TestEnvironment, Any]
  44. def failed[E](cause: Cause[E])(implicit trace: Trace): ZIO[Any, TestFailure[E], Nothing]
  45. val ignored: UIO[TestSuccess]
  46. def live(implicit trace: Trace): UIO[Live]
  47. def live[R, E, A](zio: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
  48. val liveEnvironment: Layer[Nothing, Clock with Console with System with Random]
  49. def liveWith[R, E, A](f: (Live) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
  50. def platformSpecific[R, E, A](js: => A, jvm: => A)(f: (A) => ZTest[R, E]): ZTest[R, E]
  51. def sized(implicit trace: Trace): UIO[Sized]
  52. def sizedWith[R, E, A](f: (Sized) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
  53. def suite[In](label: String)(specs: In*)(implicit suiteConstructor: SuiteConstructor[In], sourceLocation: SourceLocation, trace: Trace): Spec[OutEnvironment, OutError]
  54. def test[In](label: String)(assertion: => In)(implicit testConstructor: TestConstructor[Nothing, In], sourceLocation: SourceLocation, trace: Trace): Out
  55. def testClock(implicit trace: Trace): UIO[TestClock]
  56. def testClockWith[R, E, A](f: (TestClock) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
  57. def testConfig(implicit trace: Trace): UIO[TestConfig]
  58. def testConfigWith[R, E, A](f: (TestConfig) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
  59. def testConsole(implicit trace: Trace): UIO[TestConsole]
  60. def testConsoleWith[R, E, A](f: (TestConsole) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
  61. val testEnvironment: ZLayer[Any, Nothing, TestEnvironment]
  62. def testRandom(implicit trace: Trace): UIO[TestRandom]
  63. def testRandomWith[R, E, A](f: (TestRandom) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
  64. def testSystem(implicit trace: Trace): UIO[TestSystem]
  65. def testSystemWith[R, E, A](f: (TestSystem) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
  66. final macro def typeCheck(code: String): UIO[Either[String, Unit]]
    Definition Classes
    CompileVariants
  67. def versionSpecific[R, E, A](scala3: => A, scala2: => A)(f: (A) => ZTest[R, E]): ZTest[R, E]
  68. def withAnnotations[R, E, A <: Annotations, B](annotations: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]
  69. def withAnnotationsScoped[A <: Annotations](annotations: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]
  70. 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]
  71. def withLive[R, E, A <: Live, B](live: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]
  72. def withLiveScoped[A <: Live](live: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]
  73. def withSized[R, E, A <: Sized, B](sized: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]
  74. def withSizedScoped[A <: Sized](sized: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]
  75. def withTestConfig[R, E, A <: TestConfig, B](testConfig: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]
  76. def withTestConfigScoped[A <: TestConfig](testConfig: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]

Inherited from CompileVariants

Inherited from AnyRef

Inherited from Any

Ungrouped