π¬This is a nightly-only experimental API. (
test
)Expand description
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.
Re-exportsΒ§
pub use cli::TestOpts;
Experimental pub use self::bench::Bencher;
Experimental pub use self::bench::black_box;
Experimental pub use self::console::run_tests_console;
Experimental pub use self::options::ColorConfig;
Experimental pub use self::options::Options;
Experimental pub use self::options::OutputFormat;
Experimental pub use self::options::RunIgnored;
Experimental pub use self::options::ShouldPanic;
Experimental pub use self::ColorConfig::*;
Experimental pub use self::types::TestName::*;
Experimental pub use self::types::*;
Experimental
ModulesΒ§
- bench
Experimental - Benchmarking module.
- cli π
Experimental - Module converting command-line arguments into test configuration.
- console π
Experimental - Module providing interface for running tests in the console.
- event π
Experimental - Module containing different events that can occur during tests execution process.
- formatters π
Experimental - helpers π
Experimental - Module with common helpers not directly related to tests
but used in
libtest
. - options π
Experimental - Enums denoting options for test execution.
- stats
Experimental - term π
Experimental - Terminal formatting module.
- test
Experimental - test_
result πExperimental - time π
Experimental - Module
time
contains everything related to the time measurement of unit tests execution. The purposes of this module: - types π
Experimental - Common types used by
libtest
.
StructsΒ§
- Filtered
Tests πExperimental
ConstantsΒ§
- ERROR_
EXIT_ πCODE Experimental - SECONDARY_
TEST_ πBENCH_ BENCHMARKS_ VAR Experimental - SECONDARY_
TEST_ πINVOKER_ VAR Experimental
FunctionsΒ§
- __
rust_ πbegin_ short_ backtrace Experimental - Fixed frame used to clean the backtrace with
RUST_BACKTRACE=1
. - assert_
test_ result Experimental - Invoked when unit tests terminate. Returns
Result::Err
if the test is considered a failure. By default, invokesreport()
and checks for a0
result. - convert_
benchmarks_ to_ tests Experimental - filter_
tests Experimental - fold_
err πExperimental - make_
owned_ πtest Experimental - Clones static values for putting into a dynamic vector, which test_main() needs to hand out ownership of tests to parallel test runners.
- run_
test Experimental - run_
test_ πin_ process Experimental - run_
test_ πin_ spawned_ subprocess Experimental - run_
tests Experimental - spawn_
test_ πsubprocess Experimental - test_
main Experimental - test_
main_ static Experimental - A variant optimized for invocation with a static test vector. This will panic (intentionally) when fed any dynamic tests.
- test_
main_ static_ abort Experimental - A variant optimized for invocation with a static test vector. This will panic (intentionally) when fed any dynamic tests.
- test_
main_ with_ exit_ callback Experimental