#[fixture]Expand description
Marks a fn() -> TestResult<T> as a fixture: a reusable piece of test setup
whose failures surface as ErrorKind::Setup, never as assertion misses.
A fixture is consumed by test_with_fixtures: a test parameter
name: T is filled by the same-named fixture fn name().
By default a fixture is per-test (#[fixture] or #[fixture(scope = "test")]): the body runs afresh for every test, and the value is moved
straight out, so T need not be Clone. With #[fixture(scope = "module")]
the body runs once and every test gets a clone of the cached value, so T
must be Clone + Send + Sync + 'static.
ⓘ
use test_better::prelude::*;
#[fixture]
fn answer() -> TestResult<i32> {
Ok(42)
}
#[test_with_fixtures]
fn uses_the_answer(answer: i32) -> TestResult {
check!(answer).satisfies(eq(42))
}