Macro test_generator::glob_expand
source · glob_expand!() { /* proc-macro */ }
Expand description
deprecated 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! { "res/*"; test_exists }
fn test_exists(filename: &str) { assert!(std::path::Path::new(filename).exists()); }
}
The macro will expand the code for each subfolder in "res/*"
, generating the following
code. This code is not visible in IDE. Every build-time, the code will be newly generated.
#[cfg(test)]
mod tests {
#[test]
fn gen_res_set1() {
test_exists("res/testset1");
}
#[test]
fn gen_res_set2() {
test_exists("res/testset2");
}
}