Crate testpath[][src]

Expand description

Companion 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.


fn test_something() {
    let tmpdir = TempDir::new().expect("TempDir created");
    tmpdir.create_file("path/to/testfile", "Hello File!".as_bytes());
        .assert_utf8("Hello File!");

Panics vs. Results

‘testpath’ is made explicitly for writing tests. To ease this it prefers aborting by panic over error handling. When anything goes wrong the test is aborted and the cause is reported.


A Path that lives within a TestPath and must not outlive it.

Augment a TempDir with a custom callback function that can do additional cleanup work (like unmounting filesystem etc.)


Trait for test directoy objects

Assertions on content of a TestPath

Trait for test directoy objects