Crate testfile

source ·
Expand description

Create and manage temporary file used for unit tests. File is deleted on Drop

Structs

  • TestFile structure. Holds opened File and PathBuf. Files are created in temporary directory with unique names and deleted on Drop. Reading and writing access is supported. This structure can be dereferenced to &File and implements AsRef for Path, PathBuf and File.

Functions

  • Create test file with content supplied by initializer closure.
  • Create an empty test file.
  • Create a TestFile from string.
  • Turns an existing file into TestFile. File must exist and be readable and writable.
  • Generate unique tmp file name.