feat(test): added fixture macro

This commit is contained in:
əlemi 2024-11-05 00:19:29 +01:00
parent 300f6620c0
commit 3f0b04af6e
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -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;