Crate testcall[][src]

Expand description

Companinon crate to ‘BinTest’, implements test facilities

Description

A TestCall uses BinTest and std::process::Command to wrap process execution in a way that is ergonomic to use for (repeated) testing. Few more test facilities are provided and will grow in future.

Example

#[test]
fn myprogram_test() {
    let executables = BinTest::new();
    let mut myprogram = TestCall::new(&executables, "myprogram");

    myprogram.current_dir(Box::new(TempDir::new().expect("created tempdir")));
    myprogram
        .call(["--help"])
        .assert_success();
}

Future Plans

New features will be added as needed, PR’s are welcome. This is work in progress.

Things to be done soon are:

  • Regex filters for the stdout/stderr
  • Populating TestDirs from template directories
  • Validating directory contents

Modules

exporting things for convinience

Structs

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

A TestCall object binds a BinTest::Command to a single executable and environment and provides functions to call this multiple times.

Traits

Trait for test directoy objects

Augment std::process::Output with testing and assertions