This repository was archived by the owner on Dec 29, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,16 @@ assert_cli::assert_cli("echo", &["42"]).unwrap();
57
57
assert_cli! (" echo" , & [" 42" ] => Success ). unwrap ();
58
58
```
59
59
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
+
60
70
## License
61
71
62
72
Licensed under either of
Original file line number Diff line number Diff line change 35
35
//! # }
36
36
//! ```
37
37
//!
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
+ //!
38
50
//! Make sure to include the crate as `#[macro_use] extern crate assert_cli;`.
39
51
40
52
You can’t perform that action at this time.
0 commit comments