Crate test

Source
πŸ”¬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Β§

benchExperimental
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.
statsExperimental
term πŸ”’ Experimental
Terminal formatting module.
testExperimental
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Β§

FilteredTests πŸ”’ 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_resultExperimental
Invoked when unit tests terminate. Returns Result::Err if the test is considered a failure. By default, invokes report() and checks for a 0 result.
convert_benchmarks_to_testsExperimental
filter_testsExperimental
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_testExperimental
run_test_in_process πŸ”’ Experimental
run_test_in_spawned_subprocess πŸ”’ Experimental
run_testsExperimental
spawn_test_subprocess πŸ”’ Experimental
test_mainExperimental
test_main_staticExperimental
A variant optimized for invocation with a static test vector. This will panic (intentionally) when fed any dynamic tests.
test_main_static_abortExperimental
A variant optimized for invocation with a static test vector. This will panic (intentionally) when fed any dynamic tests.
test_main_with_exit_callbackExperimental