remove_file

Function remove_file 

Source
pub fn remove_file(file_path: &str) -> Result<()>
Expand description

Remove a file if it exists. Will not throw an error if the file does not exist.

Use to clean up temporary files created during a test. Prefer calling this function at the beginning of a test to ensure filesystem state is clean and to make debugging easier.

ยงExample

use common_testing::setup;

#[test]
fn test_1() {
  setup::remove_file("./test.txt").unwrap();
  // some test code
  setup::write_file_contents("./test.txt", &[1, 2, 3]).unwrap();
  // some more test code
}