Skip to content

Fixtures

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.

Fixtures

Helpers for async test bodies that need deterministic temporary-resource ownership.

public static class Fixtures

temporary_file

Creates an owned temporary file whose destructor cleans up after a failed or cancelled body.

public static fun temporary_file(): Result<TempFile, IoError>

temporary_directory

Creates an owned private directory for a test's temporary resources.

public static fun temporary_directory(): Result<TempDirectory, IoError>

run

Runs an async body and cleanup, preserving a body error and otherwise reporting cleanup errors.

public static async fun run<T, E>(
    fixture: TestFixture<T, E>,
    body: fun(T): Future<Result<Unit, E>>
): Result<Unit, E>