[][src]Macro test_generator::test_expand_paths

test_expand_paths!() { /* proc-macro */ }

Generate a test-function call for each file matching the pattern

extern crate test_generator;
#[cfg(test)]
mod tests {
  test_generator::test_expand_paths! { test_exists; "data/*" }

  fn test_exists(dir_name: &str) { assert!(std::path::Path::new(dir_name).exists()); }
}

Assuming "data/*" expands to "data/set1", and "data/set2" the macro will expand to

mod tests {
    #[test]
    fn test_exists_data_set1() {
        test_exists("data/set1");
    }

    #[test]
    fn test_exists_data_set2() {
        test_exists("data/set2");
    }
}