1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#![cfg(feature = "glob")]
#[test]
fn test_basic_globbing_parent_dir() {
insta::glob!("../inputs", "*.txt", |path| {
let contents = std::fs::read_to_string(path).unwrap();
insta::assert_json_snapshot!(&contents);
});
}
#[test]
fn test_basic_globbing_nested_parent_dir_base_path() {
insta::glob!("../inputs-nested", "*/*.txt", |path| {
let contents = std::fs::read_to_string(path).unwrap();
insta::assert_snapshot!(&contents);
});
}
#[test]
fn test_basic_globbing_nested_parent_glob() {
insta::glob!("..", "inputs-nested/*/*.txt", |path| {
let contents = std::fs::read_to_string(path).unwrap();
insta::assert_snapshot!(&contents);
});
}
#[test]
fn test_globs_follow_links_parent_dir_base_path() {
insta::glob!("../link-to-inputs", "*.txt", |path| {
let contents = std::fs::read_to_string(path).unwrap();
insta::assert_json_snapshot!(&contents);
});
}
#[test]
fn test_globs_follow_links_parent_dir_glob() {
insta::glob!("..", "link-to-inputs/*.txt", |path| {
let contents = std::fs::read_to_string(path).unwrap();
insta::assert_json_snapshot!(&contents);
});
}
#[test]
fn test_basic_globbing_absolute_dir() {
insta::glob!(
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/inputs"),
"*.txt",
|path| {
let contents = std::fs::read_to_string(path).unwrap();
insta::assert_json_snapshot!(&contents);
}
);
}
|