ZSuite
Attributes
- Graph
-
- Supertypes
-
trait ZRuntimetrait ZFixtureSyntaxtrait ZFixturestrait ZAssertionsclass FunSuitetrait ValueTransformstrait SuiteTransformstrait TestTransformstrait TestOptionsConversionstrait FunFixturestrait Assertionstrait CompileErrorMacroclass Suitetrait PlatformSuiteclass Objecttrait Matchableclass AnyShow all
Members list
Type members
Classlikes
Attributes
- Supertypes
-
class Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Inherited classlikes
Value parameters
- name
-
The name of this fixture, used for displaying an error message if
beforeAll()
orafterAll()
fail.
Attributes
- Inherited from:
- Suite
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- ZFixtureSyntax
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- FunFixtures
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- FunFixtures
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- ZAssertions
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- ZFixtureSyntax
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- SuiteTransforms
- Supertypes
-
trait List[Test] => List[Test]class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- TestTransforms
- Supertypes
-
trait Test => Testclass Objecttrait Matchableclass Any
Attributes
- Inherited from:
- ValueTransforms
- Supertypes
-
trait Any => Option[Future[Any]]class Objecttrait Matchableclass Any
Suite local fixture from Scoped effect.
Suite local fixture from Scoped effect.
var state = 0
val fixture = ZSuiteLocalFixture(
"sample",
ZIO.acquireRelease(ZIO.attempt { state += 1; state })(_ => ZIO.attempt { state -= 1 }.orDie)
)
override val munitFixtures = Seq(fixture)
test("suite local fixture works") {
assertEquals(fixture(), 1)
}
Attributes
- Inherited from:
- ZFixtures
- Supertypes
-
class Objecttrait Matchableclass Any
Test-local fixture.
Test-local fixture.
Can be created from raw setup/teardown effects or from Scoped effect.
val rawZIOFunFixture = ZTestLocalFixture(options => ZIO.succeed(s"acquired ${options.name}")) { str =>
putStrLn(s"cleanup [$str]").provideLayer(Console.live)
}
val scopedFunFixture = ZTestLocalFixture { options =>
ZIO.acquireRelease(ZIO.succeed(s"acquired ${options.name} with Scoped")) { str =>
printLine(s"cleanup [$str] with Scoped").orDie
}
}
rawZIOFunFixture.test("allocate resource with ZIO FunFixture") { str =>
assertNoDiff(str, "acquired allocate resource with ZIO FunFixture")
}
scopedFunFixture.test("allocate resource with Scoped FunFixture") { str =>
assertNoDiff(str, "acquired allocate resource with Scoped FunFixture with Scoped")
}
Attributes
- Inherited from:
- ZFixtures
- Supertypes
-
class Objecttrait Matchableclass Any
Inherited types
Attributes
- Inherited from:
- Suite
Attributes
- Inherited from:
- Suite
Attributes
- Inherited from:
- Suite
The value produced by test bodies.
The value produced by test bodies.
Attributes
- Inherited from:
- FunSuite
Value members
Concrete methods
Attributes
- Definition Classes
-
ValueTransforms
Runs test returning ZIO[Any, E, Any]
Runs test returning ZIO[Any, E, Any]
testZ("simple effect test") {
val effect = for
a <- ZIO(1)
b <- ZIO(2)
yield a + b
assertEqualsZ(effect, 3)
}
Value parameters
- body
-
test body
- name
-
test name
Attributes
Inherited methods
Runs once after all test cases and after all suite-local fixtures have been tear down.
Runs once after all test cases and after all suite-local fixtures have been tear down.
Attributes
- Inherited from:
- Suite
Runs after each individual test case.
Runs after each individual test case.
Attributes
- Inherited from:
- Suite
Attributes
- Inherited from:
- Assertions
Asserts that two elements are equal using ==
equality.
Asserts that two elements are equal using ==
equality.
The "expected" value (second argument) must have the same type or be a subtype of the "obtained" value (first argument). For example:
assertEquals(Option(1), Some(1)) // OK
assertEquals(Some(1), Option(1)) // Error: Option[Int] is not a subtype of Some[Int]
Use assertEquals[Any, Any](a, b)
as an escape hatch to compare two values of different types. For example:
val a: Either[List[String], Int] = Right(42)
val b: Either[String, Int] = Right(42)
assertEquals[Any, Any](a, b) // OK
assertEquals(a, b) // Error: Either[String, Int] is not a subtype of Either[List[String], Int]
Attributes
- Inherited from:
- Assertions
Asserts that two doubles are equal to within a positive delta. If the expected value is infinity then the delta value is ignored. NaNs are considered equal: assertEquals(Double.NaN, Double.NaN, *) passes.
Asserts that two doubles are equal to within a positive delta. If the expected value is infinity then the delta value is ignored. NaNs are considered equal: assertEquals(Double.NaN, Double.NaN, *) passes.
Attributes
- Inherited from:
- Assertions
Asserts that two floats are equal to within a positive delta. If the expected value is infinity then the delta value is ignored. NaNs are considered equal: assertEquals(Float.NaN, Float.NaN, *) passes.
Asserts that two floats are equal to within a positive delta. If the expected value is infinity then the delta value is ignored. NaNs are considered equal: assertEquals(Float.NaN, Float.NaN, *) passes.
Attributes
- Inherited from:
- Assertions
Asserts that ZIO[R, E, A]
returns the same result as expected
Asserts that ZIO[R, E, A]
returns the same result as expected
testZ("strings are the same") {
val effect = ZIO.succeed("string")
assertEqualsZ(effect, "string", "different strings")
}
Value parameters
- clue
-
a value that will be printed in case the assertions fail
- expected
-
expected result
- obtained
-
the effect to be tested
Attributes
- Inherited from:
- ZAssertions
Attributes
- Inherited from:
- Assertions
Asserts that ZIO[R, E, String]
has no difference with expected string. Pretty prints diff unlike just assertEqualsZ
.
Asserts that ZIO[R, E, String]
has no difference with expected string. Pretty prints diff unlike just assertEqualsZ
.
testZ("strings are the same") {
val effect = ZIO.succeed("string")
assertNoDiffZ(effect, "string", "different strings")
}
Value parameters
- clue
-
a value that will be printed in case the assertions fail
- expected
-
expected string
- obtained
-
the string effect to be tested
Attributes
- Inherited from:
- ZAssertions
Attributes
- Inherited from:
- Assertions
Asserts that ZIO[R, E, A]
returns NOT the same result as expected
Asserts that ZIO[R, E, A]
returns NOT the same result as expected
testZ("strings are the same") {
val effect = ZIO.succeed("string")
assertNotEqualsZ(effect, "another string", "same strings")
}
Value parameters
- clue
-
a value that will be printed in case the assertions fail
- expected
-
expected result
- obtained
-
the effect to be tested
Attributes
- Inherited from:
- ZAssertions
Asserts that ZIO[R, E, Boolean]
returns true
.
Asserts that ZIO[R, E, Boolean]
returns true
.
testZ("false OR true should be true") {
val effect = ZIO.succeed(false || true)
assertZ(effect, "boolean algebra check failed")
}
Value parameters
- clue
-
a value that will be printed in case the assertions fail
- cond
-
the boolean effect to be tested
Attributes
- Inherited from:
- ZAssertions
Attributes
- Inherited from:
- Assertions
Runs once before all test cases and before all suite-local fixtures are setup. An error in this method aborts the test suite.
Runs once before all test cases and before all suite-local fixtures are setup. An error in this method aborts the test suite.
Attributes
- Inherited from:
- Suite
Runs before each individual test case. An error in this method aborts the test case.
Runs before each individual test case. An error in this method aborts the test case.
Attributes
- Inherited from:
- Suite
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- CompileErrorMacro
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- SuiteTransforms
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- Suite
Attributes
- Inherited from:
- TestTransforms
Functinonal fixtures that can be reused for individual test cases or entire suites.
Functinonal fixtures that can be reused for individual test cases or entire suites.
Attributes
- Inherited from:
- Suite
Attributes
- Inherited from:
- TestTransforms
Attributes
- Inherited from:
- TestTransforms
Attributes
- Inherited from:
- ValueTransforms
Attributes
- Inherited from:
- SuiteTransforms
Attributes
- Inherited from:
- SuiteTransforms
Attributes
- Inherited from:
- SuiteTransforms
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- SuiteTransforms
Attributes
- Inherited from:
- SuiteTransforms
Attributes
- Inherited from:
- TestTransforms
Attributes
- Inherited from:
- TestTransforms
The base class for all test suites
The base class for all test suites
Attributes
- Inherited from:
- FunSuite
Attributes
- Inherited from:
- FunSuite
Attributes
- Inherited from:
- ValueTransforms
Attributes
- Inherited from:
- FunSuite
Attributes
- Inherited from:
- FunSuite
Inherited fields
Attributes
- Inherited from:
- Assertions
Attributes
- Inherited from:
- FunSuite
Implicits
Inherited implicits
Attributes
- Inherited from:
- ZFixtureSyntax
Attributes
- Inherited from:
- ZAssertions
Attributes
- Inherited from:
- ZFixtureSyntax
Implicitly create a TestOptions given a test name. This allows writing test("name") { ... }
even if test
accepts a TestOptions
Implicitly create a TestOptions given a test name. This allows writing test("name") { ... }
even if test
accepts a TestOptions
Attributes
- Inherited from:
- TestOptionsConversions