test_dir

Crates.iotest_dir
lib.rstest_dir
version0.2.0
sourcesrc
created_at2019-10-09 13:53:29.099182
updated_at2022-04-05 08:12:17.381414
descriptionEasy creation of temporary file structure for test purpose.
homepage
repositoryhttps://github.com/rpacholek/test_dir
max_upload_size
id171223
size14,702
Rafał Pachołek (rpacholek)

documentation

README

TestDir

Fast creation of file structure for testing purpose.

Getting Started

Add the following dependency to Cargo manifest:

[dependencies]
test_dir = "0.1.0"

Example

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)

Commit count: 4

cargo fmt