[−][src]Macro test_generator::glob_expand
glob_expand!() { /* proc-macro */ }
Function-Attribute macro expanding glob-file-pattern to a list of directories and generating a test-function for each one.
#[cfg(test)] mod tests { extern crate test_generator; test_generator::glob_expand! { "data/*"; test_exists } fn test_exists(filename: &str) { assert!(std::path::Path::new(filename).exists()); } }
The macro will expand the code for each subfolder in "data/*"
, generating the following
code. This code is not visible in IDE. Every build-time, the code will be newly generated.
mod tests { #[test] fn gen_data_set1() { test_exists("data/testset1"); } #[test] fn gen_data_set2() { test_exists("data/testset2"); } }