Attribute Macro test_each::file

source ·
#[file]
Expand description

Generate a series of tests that receive file contents as strings, based on the result of a glob pattern.

This excludes any matched directories.

Usage

#[test_each::file("data/*.txt")]
fn test_file(content: &str) {
    // test contents
}

Add a second parameter of type PathBuf to receive the path of the file.

#[test_each::file("data/*.txt")]
fn test_file(content: &str, path: PathBuf) {
    // test contents
}