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.

Example

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.

Modules

#[cfg] tests
Quis testabitur ipsos testes

Structs

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

Functions