Create integration test functions

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.

mod integration {

    macro_rules! actcheck_test {
        ($($name:ident: $name1: expr, )*) => {
                fn $name() {
                    println!("Function name is {}", $name1);


My question: is there a possibility to construct the macro in a way that I could call it like follows?


Then act1 aso should be used as the function name on the one hand, and as a string on the other hand.

Take a look at the stringify! macro. You should be able to use stringify!($name) inside the macro code.

1 Like

Great! Thanks a lot.

This does it nicely.