Struct test_casing::decorators::Sequence

source ·
pub struct Sequence { /* private fields */ }
Expand description

Test decorator that makes runs of decorated tests sequential. The sequence can optionally be aborted if a test in it fails.

The run ordering of tests in the sequence is not deterministic. This is because depending on the command-line args that the test was launched with, not all tests in the sequence may run at all.

§Examples

use test_casing::{decorate, decorators::{Sequence, Timeout}};

static SEQUENCE: Sequence = Sequence::new().abort_on_failure();

#[test]
#[decorate(&SEQUENCE)]
fn sequential_test() {
    // test logic
}

#[test]
#[decorate(Timeout::secs(1), &SEQUENCE)]
fn other_sequential_test() {
    // test logic
}

Implementations§

source§

impl Sequence

source

pub const fn new() -> Self

Creates a new test sequence.

source

pub const fn abort_on_failure(self) -> Self

Makes the decorated tests abort immediately if one test from the sequence fails.

Trait Implementations§

source§

impl Debug for Sequence

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DecorateTest<()> for Sequence

source§

fn decorate_and_test<F: TestFn<()>>(&self, test_fn: F)

Decorates the provided test function and runs the test.
source§

impl<E: 'static> DecorateTest<Result<(), E>> for Sequence

source§

fn decorate_and_test<F>(&self, test_fn: F) -> Result<(), E>
where F: TestFn<Result<(), E>>,

Decorates the provided test function and runs the test.
source§

impl Default for Sequence

source§

fn default() -> Sequence

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.