Skip to content

std/testing

Testing helpers built on the assertion runtime.

Testing.check(expr) uses the same assertion machinery as assert expr, but returns Result<Subject, AssertionFailure> instead of propagating the failure. It is useful when tests need to inspect or render a failure value.

Import with import std/testing.

Modules

fn check<'T>(subject: 'T): Result<'T, AssertionFailure>

Returns Ok(subject) when subject would pass assert; otherwise returns Err(failure) with the same structured assertion context used by nomi test.

Interactive Tests

refute Testing.check(1 == 2)