pub fn get_read_and_write_file(path: &str) -> Result<File>Expand description
Get a read and write file handle. Use this to create temporary files for testing and comparison. The file will be created if it does not exist, and it will be overridden if it does.
Prefer this function if you are testing dynamic content being written to a file during the test. Prefer setup::get_file_contents() when you need to get the contents of a file to load a fixture or large data. Prefer assert::equal_file_contents() when you need to compare the contents of a file as the result of a test.
ยงExample
use common_testing::setup;
#[test]
fn test_1() {
let mut file = setup::get_read_and_write_file("./test.txt").unwrap();
// some test code
}