This repository was archived by the owner on Dec 29, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,16 @@ assert_cli::assert_cli("echo", &["42"]).unwrap();
5757assert_cli! (" echo" , & [" 42" ] => Success ). unwrap ();
5858```
5959
60+ All exported functions and the macro return a ` Result ` containing the
61+ ` Output ` of the process, allowing you to do further custom assertions:
62+
63+ ``` rust
64+ #[macro_use] extern crate assert_cli;
65+ let output = assert_cli! (" echo" , & [" Number 42" ] => Success ). unwrap ();
66+ let stdout = std :: str :: from_utf8 (& output . stdout). unwrap ();
67+ assert! (stdout . contains (" 42" ));
68+ ```
69+
6070## License
6171
6272Licensed under either of
Original file line number Diff line number Diff line change 3535//! # }
3636//! ```
3737//!
38+ //! All exported functions and the macro return a `Result` containing the
39+ //! `Output` of the process, allowing you to do further custom assertions:
40+ //!
41+ //! ```rust
42+ //! # #[macro_use] extern crate assert_cli;
43+ //! # fn main() {
44+ //! let output = assert_cli!("echo", &["Number 42"] => Success).unwrap();
45+ //! let stdout = std::str::from_utf8(&output.stdout).unwrap();
46+ //! assert!(stdout.contains("42"));
47+ //! # }
48+ //! ```
49+ //!
3850//! Make sure to include the crate as `#[macro_use] extern crate assert_cli;`.
3951
4052
You can’t perform that action at this time.
0 commit comments