1 unstable release
0.1.0 | Aug 9, 2019 |
---|
#16 in #temp
18KB
137 lines
Tempdir injection for tests
This small project is providing you a procedural macro to inject a temporary directory in your test.
#[with_tempdir]
#[test]
fn my_test(path: &Path) {
// do stuff in folder `path`
}
Look at the documentation for more.
lib.rs
:
This crate provide the with_tempdir
macro.
use with_tempdir::with_tempdir;
#[with_tempdir(path = "/tmp/foo")]
#[test]
fn my_test(path: &Path) {
let file_path = path.join("some_file.txt");
let mut file = File::create(&file_path).expect("Failed to create the file");
}
Read the documentation of with_tempdir
macro to
know more.
Dependencies
~4–11MB
~158K SLoC