test_dir 0.2.0

Easy creation of temporary file structure for test purpose.
Documentation
  • Coverage
  • 100%
    22 out of 22 items documented1 out of 18 items with examples
  • Size
  • Source code size: 17.77 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 752.73 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • rpacholek/test_dir
    0 2 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • rpacholek

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)