Attribute Macro blob

Source
#[blob]
Expand description

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

This excludes any matched directories.

§Usage

#[test_each::blob("data/*.bin")]
fn test_bytes(content: &[u8]) {
    // test contents
}

Add a second parameter that implements AsRef for Path to receive the path of the file.

#[test_each::blob("data/*.bin")]
fn test_bytes(content: &[u8], path: &Path) {
    // test contents
}

§Customizing the function name

Use name(segments = <n>) to use up to n path segments in the generated function name.

Use name(extension) to include the file extension in the generated function name.

Use name(index) to include a unique index in the generated function name.

#[test_each::blob("data/*.txt", name(segments = 2, extension, index))]
fn test_file(_: &[u8]) {  }