Skip to main content

testcase

Macro testcase 

Source
macro_rules! testcase {
    (|$args:ident: &mut $arg_ty:ty| -> $item_ty:ty $body:block) => { ... };
    (|$args:ident: &mut $arg_ty:ty| $body:expr) => { ... };
    (|| -> $item_ty:ty $body:block) => { ... };
    (|| $body:expr) => { ... };
}
Expand description

Shorthand for implementing TestCase.

Four forms are supported:

// No shared state, FactoryItem defaults to ()
testcase!(|| {
    // ... return (driver, factory)
})

// No shared state, explicit FactoryItem
testcase!(|| -> ItemType {
    // ... return (driver, factory)
})

// With shared state, FactoryItem defaults to ()
testcase!(|args: &mut ArgsType| {
    // ... return (driver, factory)
})

// With shared state, explicit FactoryItem
testcase!(|args: &mut ArgsType| -> ItemType {
    // ... return (driver, factory)
})

The body must return a (Driver, factory) tuple where factory is an async move |item: ItemType| { ... } closure.