Crates.io | test_dir |
lib.rs | test_dir |
version | 0.2.0 |
source | src |
created_at | 2019-10-09 13:53:29.099182 |
updated_at | 2022-04-05 08:12:17.381414 |
description | Easy creation of temporary file structure for test purpose. |
homepage | |
repository | https://github.com/rpacholek/test_dir |
max_upload_size | |
id | 171223 |
size | 14,702 |
Fast creation of file structure for testing purpose.
Add the following dependency to Cargo manifest:
[dependencies]
test_dir = "0.1.0"
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
Licensed under MIT license, (LICENSE)