Function tmx_utils::test_utils::run_file_test
source · pub fn run_file_test<T>(test: T, path: &str, contents: &str)where
T: FnOnce(File) + UnwindSafe,Expand description
Runs a test on a File with a teardown function that is guaranteed to delete the file after the test
Panics
If the file cannot be opened
Examples
use tmx_utils::string_ext::read_string;
use std::io::BufReader;
let path = "./run_file_test.txt";
let content = "input_string";
run_file_test(
|f| {
assert_eq!(
read_string(BufReader::new(f)).unwrap(),
content
);
},
path, content,
);