Module

poke/fixture

src/poke/fixture.pooka

Borrow a resource, and return it even when a test fails. Cleanup runs for successful callbacks and exceptions. Abrupt process death cannot run an after block; the temporary root is kept under build for that case.

API reference

function

with_resource

src/poke/fixture.pooka:15
with_resource(setup: fn() -> a, cleanup: fn(a) -> Nil, run: fn(a) -> b) -> b
INFERREDfn(fn() -> a, fn(a) -> Nil, fn(a) -> b) -> b

Setup runs once. Cleanup runs once after the callback, including on failure.

function

with_directory

src/poke/fixture.pooka:24
with_directory(run: fn(String) -> a) -> a
INFERREDfn(fn(String) -> a) -> a

Each callback owns a fresh directory. It and its contents are removed on exit.

Pooka
fixture.with_directory(fn(path) { should.be_ok(file.write(path + "/note", "hello")) })