ZTestLocalFixture

munit.ZFixtures.ZTestLocalFixture

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

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply[E, A](setup: TestOptions => IO[E, A])(teardown: A => IO[E, Unit]): FunFixture[A]
def apply[E, A](create: TestOptions => ZIO[Scope, E, A]): FunFixture[A]