Created
December 5, 2019 20:21
-
-
Save rust-play/bca9865bb80610e5c362181ccdcf5f00 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! test_cases { | |
(@ [ :: $variant:ident :: stream :: compress ]) => { | |
#[test] fn a() { } | |
}; | |
(@ [ :: $variant:ident :: futures :: write :: compress ]) => { | |
#[test] fn b() { } | |
}; | |
(@ [ :: $variant:ident :: futures :: write :: decompress ]) => { | |
#[test] fn c() { } | |
}; | |
// expansions, generating a `mod $ident { }` around each level | |
($variant:ident) => { | |
test_cases!($variant::{stream::compress, futures::write::{compress, decompress}}); | |
}; | |
} | |
test_cases!(foobar); | |
// mod foobar { | |
// mod stream { | |
// mod compress { | |
// #[test] fn a() {} | |
// } | |
// } | |
// mod futures { | |
// mod write { | |
// mod compress { | |
// #[test] fn b() {} | |
// } | |
// mod decompress { | |
// #[test] fn c() {} | |
// } | |
// } | |
// } | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment