assert_cli 0.2.2

Test CLI Applications.

Test CLI Applications

Currently, this crate only includes basic functionality to check the output of a child process is as expected.


Here's a trivial example:

# extern crate assert_cli;

assert_cli::assert_cli_output("echo", &["42"], "42").unwrap();

And here is one that will fail:

assert_cli::assert_cli_output("echo", &["42"], "1337").unwrap();

this will show a nice, colorful diff in your terminal, like this:


Alternatively, you can use the assert_cli! macro:

# #[macro_use] extern crate assert_cli;
# fn main() {
assert_cli!("echo", &["42"] => Success, "42").unwrap();
# }

Make sure to include the crate as #[macro_use] extern crate assert_cli;.