Macro assert_cli::assert_cmd
[−]
[src]
macro_rules! assert_cmd { ($($x:tt)+) => { ... }; }
Easily construct an Assert
with a custom command
Make sure to include the crate as #[macro_use] extern crate assert_cli;
if
you want to use this macro.
Examples
To test that our very complex cli applications succeeds and prints some text to stdout that contains
No errors whatsoever
you would call it like this:
#[macro_use] extern crate assert_cli; assert_cmd!(echo "Launch sequence initiated.\nNo errors whatsoever!\n") .succeeds() .prints("No errors whatsoever") .unwrap();
The macro will try to convert its arguments as strings, but is limited by
Rust's default tokenizer, e.g., you always need to quote CLI arguments
like "--verbose"
.