test
test: test runtime and testing tools
The test module provides runtime support for tests run via @test (see hare-test(1)). The build driver automatically links test executables to the test module, and user tests may include the test module to access additional runtime features for testing.
These functions will abort if they're called from outside of a test.
Index
Functions
fn current() str;
fn expectabort() void;
fn require(keywords: str...) void;
fn skip(why: fmt::formattable...) never;
fn skipf(fmt: str, args: fmt::field...) never;
Functions
fn current
fn current() str;
Returns the name of the currently running test.
fn expectabort
fn expectabort() void;
Expect the currently running test to abort. The test will fail if it doesn't abort.
fn require
fn require(keywords: str...) void;
Check the $HARETEST_INCLUDE space-delimited environment variable for keywords. If any of the keywords aren't present, the currently running test is skipped.
fn skip
fn skip(why: fmt::formattable...) never;
Skip the currently running test, formatting the message like with fmt::fprint.
fn skipf
fn skipf(fmt: str, args: fmt::field...) never;
Skip the currently running test, formatting the message like with fmt::fprintf.