test+x86_64 +linux

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[permalink] [source]

fn current() str;

Returns the name of the currently running test.

fn expectabort[permalink] [source]

fn expectabort() void;

Expect the currently running test to abort. The test will fail if it doesn't abort.

fn require[permalink] [source]

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[permalink] [source]

fn skip(why: fmt::formattable...) never;

Skip the currently running test, formatting the message like with fmt::fprint.

fn skipf[permalink] [source]

fn skipf(fmt: str, args: fmt::field...) never;

Skip the currently running test, formatting the message like with fmt::fprintf.