Attribute Macro test_data_file

Source
#[test_data_file]
Expand description

Provide sample data from a file to your test function

§Arguments

  • path - path to the sample
  • kind - optional file format (if extension is not specified)

§Example

use test_data_file::test_data_file;
#[test_data_file(path = "tests/samples/test_me.yaml")]
#[test]
fn test_is_name_above_max_size(name: Option<String>, max_size: usize, is_above: bool) {
    assert_eq!(
        name.map(|n| n.len()) > Some(max_size),
        is_above,
        "failed for {max_size}"
    );
}