Attribute Macro rstest_reuse::apply[][src]

#[apply]

Apply a defined template. The function signature should satisfy the template attributes but can also add some other fixtures. Example:

use rstest::{rstest, fixture};
use rstest_reuse::{self, *};

#[fixture]
fn empty () -> Vec<u32> {
    Vec::new()    
}

#[template]
#[rstest(a,  b,
    case(2, 2),
    case(4/2, 2),
    )
]
fn two_simple_cases(a: u32, b: u32) {}

#[apply(two_simple_cases)]
fn it_works(mut empty: Vec<u32>, a: u32, b: u32) {
    empty.append(a);
    assert!(empty.last() == b);
}