Crates.io | testpath |
lib.rs | testpath |
version | 0.2.0 |
source | src |
created_at | 2021-07-13 13:18:36.983823 |
updated_at | 2021-12-07 18:20:39.120027 |
description | companinon crate to bintest/testcall, augments Paths for testing |
homepage | |
repository | https://github.com/cehteh/testpath.git |
max_upload_size | |
id | 422268 |
size | 1,431,573 |
Companinon crate to ‘bintest' and 'testcall’, implements facilities for running tests in directories.
Allows creating of (temporary) test directories, optionally with a custom callback for cleanup. Populating these with content for testing and provide assertion to validate the content.
#[test]
fn test_something() {
let tmpdir = TempDir::new().expect("TempDir created");
tmpdir.create_file("path/to/testfile", "Hello File!".as_bytes());
tmpdir
.sub_path("path/to/testfile")
.assert_utf8("Hello File!");
}
New features will be added as needed, PR’s are welcome. This is work in progress.