#temporary-files #temporary #unit-testing

nightly testfile

Temporary test file management for unit tests

10 releases

0.1.5 Jun 26, 2024
0.1.4 Mar 22, 2023
0.1.1 Feb 27, 2023
0.0.4 Apr 11, 2021
0.0.2 Jun 14, 2020

#523 in Filesystem

Download history 1/week @ 2024-07-01 7/week @ 2024-08-19 17/week @ 2024-08-26 16/week @ 2024-09-16 23/week @ 2024-09-23 24/week @ 2024-09-30 1/week @ 2024-10-07 10/week @ 2024-10-14

59 downloads per month
Used in 2 crates

MIT license

19KB
357 lines

testfile for Rust unit tests

License: MIT Crates.io dependency status Documentation Lines of code Gitlab pipeline Downloads

Library for creating automaticaly deleted test files for use in your Rust unit tests. Do not worry about manual temporary file cleanups.

Managed temporary files are created in system temporary directory with unique file names. They can be dereferenced as ordinary File and are automatically deleted during Drop.

Functions do not return Result <T,E> but panic! allowing you to focus on your tests and not on error handling.

Nightly Rust is not required.

Implemented traits for TestFile

  1. Testfile can be dereferenced as File making it drop in replacement.
  2. implements AsRef / AsMut for Read, Write, File, PathBuf, Path.
  3. implements From String and PathBuf.

Dependencies

~310KB