test - Rust (original) (raw)

🔬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 andblack_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.

pub use self::bench::[Bencher](bench/struct.Bencher.html "struct test::bench::Bencher");Experimental

pub use self::bench::[black_box](bench/fn.black%5Fbox.html "fn test::bench::black_box");Experimental

pub use self::[ColorConfig](enum.ColorConfig.html "enum test::ColorConfig")::*;Experimental

pub use self::types::[TestName](enum.TestName.html "enum test::TestName")::*;Experimental

pub use [NamePadding](enum.NamePadding.html "enum test::NamePadding")::*;Experimental

pub use [TestFn](enum.TestFn.html "enum test::TestFn")::*;Experimental

pub use [TestName](enum.TestName.html "enum test::TestName")::*;Experimental

benchExperimental

Benchmarking module.

statsExperimental

testExperimental

OptionsExperimental

Options for the test run defined by the caller (instead of CLI arguments). In case we want to add other options as well, just add them in this struct.

TestDescExperimental

TestDescAndFnExperimental

TestIdExperimental

TestOptsExperimental

ColorConfigExperimental

Whether should console output be colored or not

NamePaddingExperimental

OutputFormatExperimental

Format of the test results output

RunIgnoredExperimental

Whether ignored test should be run or not

ShouldPanicExperimental

Whether test is expected to panic or not

TestFnExperimental

TestNameExperimental

TestTypeExperimental

Type of the test according to the Rust bookconventions.

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 0result.

convert_benchmarks_to_testsExperimental

filter_testsExperimental

run_testExperimental

run_testsExperimental

run_tests_consoleExperimental

A simple console test runner. Runs provided tests reporting process and results to the stdout.

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.