Crate test
Support code for rustc's built in unit-test and micro-benchmarking framework.
Almost all user code will only be interested in Bencher and
black_box. All other interactions (such as writing tests and
benchmarks themselves) should be done via the #[test] and
#[bench] attributes.
See the Testing Chapter of the book for more details.
Modules
Structs
Enums
- ColorConfig Whether should console output be colored or not
- OutputFormat Format of the test results output
- RunIgnored Whether ignored test should be run or not
- ShouldPanic Whether test is expected to panic or not
Functions
-
assert_test_result
Invoked when unit tests terminate. Returns
Result::Errif the test is considered a failure. By default, invokesreport()and checks for a0result. -
black_box
An identity function that hints to the compiler to be maximally pessimistic about what
black_boxcould do. - convert_benchmarks_to_tests
- filter_tests
-
print_merged_doctests_times
Public API used by rustdoc to display the
totalandcompilationtimes in the expected format. - run_test
- run_tests
- run_tests_console A simple console test runner. Runs provided tests reporting process and results to the stdout.
- test_main
- test_main_static A variant optimized for invocation with a static test vector. This will panic (intentionally) when fed any dynamic tests.
- test_main_static_abort A variant optimized for invocation with a static test vector. This will panic (intentionally) when fed any dynamic tests.
- test_main_with_exit_callback
Constants
- ERROR_EXIT_CODE Process exit code to be used to indicate test failures.