17 releases
| 0.2.0-alpha.7 | May 11, 2025 |
|---|---|
| 0.2.0-alpha.6 | May 9, 2025 |
| 0.1.5 | Jun 26, 2024 |
| 0.1.4 | Mar 22, 2023 |
| 0.0.2 | Jun 14, 2020 |
#1604 in Filesystem
331 downloads per month
Used in 4 crates
50KB
922 lines
testfile/dir management for Rust unit tests
Library for creating automaticaly deleted test files or directories for use in your Rust unit tests. Do not worry about manual temporary file/dir cleanups anymore.
Managed temporary files/directories 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.
Because of panic! style error handling its not recommended to use this library outside of unit/integration tests.
Implemented traits for TestFile
- Testfile can be dereferenced as File making it drop in replacement.
- implements
AsRef/AsMutfor Read, Write, File, PathBuf, Path. - implements
FromString, &str, &Path and PathBuf. - self-referential for flexible usage.
Implemented traits for TestDir
- TestDir can be dereferenced as Path and PathBuf.
- self-referential for flexible usage.
- implements
FromPathBuf, &Path.
Rust 2021 Edition fully compatible
Runs on MSRV 1.56 including its own unit tests. It can be used on any version of Rust 2021 edition. Compiles and runs on Rust edition 2024 without warnings.
Lightweight dependencies
Depends only on small stdrandom crate which is MSRV 1.56 compatible.
License
Licensed under permissive MIT License.
Dependencies
~59KB