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(reason: str) 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 all the keywords are present, return void. Otherwise, skip the currently running test.
fn skip
fn skip(reason: str) never;
Skip the currently running test.