ZFixtures
munit.ZFixtures
trait ZFixtures
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class ZSuite
- Self type
Members list
Type members
Classlikes
object ZSuiteLocalFixture
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
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ZSuiteLocalFixture.type
object ZTestLocalFixture
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
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ZTestLocalFixture.type
In this article