test - Rust
Description: API documentation for the Rust `test` crate.
Keywords: rust, rustlang, rust-lang, test

# [−][src]Crate test

🔬 This is a nightly-only experimental API. (`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.

## Re-exports

`pub use self::ColorConfig::*;`
`pub use NamePadding::*;`
`pub use TestName::*;`
`pub use TestFn::*;`
`pub use self::types::TestName::*;`
`pub use self::bench::Bencher;`

## Modules

bench | Experimental Benchmarking module.
stats | Experimental
test | Experimental

## Structs

Options | Experimental 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.
TestDesc | Experimental
TestDescAndFn | Experimental
TestOpts | Experimental

## Enums

ColorConfig | Experimental Whether should console output be colored or not
NamePadding | Experimental
OutputFormat | Experimental Format of the test results output
RunIgnored | Experimental Whether ignored test should be runned or not
ShouldPanic | Experimental Whether test is expected to panic or not
TestFn | Experimental
TestName | Experimental
TestType | Experimental Type of the test according to the rust book conventions.

## Traits

TDynBenchFn | Experimental Represents a benchmark function.

## Functions

assert_test_result | Experimental Invoked when unit tests terminate. Should panic if the unit Tests is considered a failure. By default, invokes `report()` and checks for a `0` result.
black_box | Experimental An identity function that hints to the compiler to be maximally pessimistic about what `black_box` could do.
convert_benchmarks_to_tests | Experimental
filter_tests | Experimental
run_test | Experimental
run_tests | Experimental
run_tests_console | Experimental A simple console test runner. Runs provided tests reporting process and results to the stdout.
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.