Module test

Minimal unit test runner

When --cfg test is provided as an argument to the compiler, this module will override the main entrypoint with the test runner which will run all the test cases defined in the code that is being compiled.

Each test case is executed in a subprocess.


Test attributes

The following attributes are supported: #[test(ignore)] to skip execution of a test (useful e.g. to make sure that a test compiles but is not run), #[test(should_fail)] to mark a test as expected to fail (e.g. through panic).

Custom test frameworks

Nothing prevents you from writing your own framework, just compile with --cfg custom_test_framework and use the test support glue in runtime to get the test cases.


#[cfg] tests
Quis testabitur ipsos testes


Holder for the results of a test case.
Command line arguments for the test runner.