I have a bunch of test functions which are all pretty similar. There is only a single string which is different.
Instead of writing down 24 test function I thought it might be a good idea to create them.
Here is a simplified example (in reality the content of the test function is different, of course.
#[cfg(test)]
mod integration {
macro_rules! actcheck_test {
($($name:ident: $name1: expr, )*) => {
$(
#[test]
fn $name() {
println!("Function name is {}", $name1);
assert_eq!(1,1);
}
)*
}
}
actcheck_test!{
act1:"act1",
act2:"act2",
}
}
My question: is there a possibility to construct the macro in a way that I could call it like follows?
actcheck_test!{
act1,
act2,
}
Then act1
aso should be used as the function name on the one hand, and as a string on the other hand.