https://github.com/rpacholek/test_dir
Fast creation of file structure for testing purpose in Rust.
https://github.com/rpacholek/test_dir
rust testing
Last synced: 7 months ago
JSON representation
Fast creation of file structure for testing purpose in Rust.
- Host: GitHub
- URL: https://github.com/rpacholek/test_dir
- Owner: rpacholek
- License: mit
- Created: 2019-10-08T19:32:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-29T13:37:18.000Z (over 2 years ago)
- Last Synced: 2025-10-26T03:31:31.288Z (8 months ago)
- Topics: rust, testing
- Language: Rust
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TestDir
Fast creation of file structure for testing purpose.
## Getting Started
Add the following dependency to Cargo manifest:
```toml
[dependencies]
test_dir = "0.1.0"
```
## Example
```rust
use test_dir::{TestDir,FileType,DirBuilder};
{
let temp = TestDir::temp()
.create("test/dir", FileType::Dir)
.create("test/file", FileType::EmptyFile)
.create("test/random_file", FileType::RandomFile(100))
.create("otherdir/zero_file", FileType::ZeroFile(100));
let path: PathBuf = temp.path("test/random_file");
assert!(path.exists());
}
// temp out-of-scope -> temp dir deleted
```
## License
Licensed under MIT license, ([LICENSE](LICENSE))