mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-21 23:04:49 +01:00
feat(test): added fixture macro
This commit is contained in:
parent
300f6620c0
commit
3f0b04af6e
1 changed files with 20 additions and 0 deletions
|
@ -78,3 +78,23 @@ macro_rules! assert_or_err {
|
|||
}
|
||||
|
||||
pub use assert_or_err;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! fixture {
|
||||
($fixture:expr => | $($arg:ident),* | $body:expr) => {
|
||||
#[allow(unused_parens)]
|
||||
$fixture
|
||||
.with(|($($arg),*)| {
|
||||
$(
|
||||
let $arg = $arg.clone();
|
||||
)*
|
||||
|
||||
async move {
|
||||
$body
|
||||
}
|
||||
})
|
||||
.await;
|
||||
};
|
||||
}
|
||||
|
||||
pub use fixture;
|
||||
|
|
Loading…
Reference in a new issue