Skip to content

TestFixture

1 min read

Import: import system.testing;

Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.

TestFixture

Owns one fixture and runs its cleanup on explicit close, scope exit, or async-frame cancellation.

public class TestFixture<T, E>

constructor

Registers deterministic cleanup before the fixture is exposed to test code.

public constructor(value: T, cleanup: fun(T): Result<Unit, E>)

resource

Borrows the fixture value while this owner remains alive.

public get resource(): T

close

Executes cleanup once and returns the same outcome to repeated callers.

public fun close(): Result<Unit, E>