Skip to content
This repository was archived by the owner on Dec 29, 2021. It is now read-only.

Commit 1f042ba

Browse files
committed
Change stdout/sterr asseertion API
BREAKING CHANGE: - `.prints` -> `.stdout().contains` - `.prints_exactly` -> `.stdout().is` - `.prints_error` -> `.stderr().contains` - `.prints_error_exactly` -> `.stderr().is`
1 parent c25b46b commit 1f042ba

File tree

4 files changed

+120
-163
lines changed

4 files changed

+120
-163
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Here's a trivial example:
2121
extern crate assert_cli;
2222

2323
fn main() {
24-
assert_cli::Assert::command(&["echo", "42"]).prints("42").unwrap();
24+
assert_cli::Assert::command(&["echo", "42"]).stdout().contains("42").unwrap();
2525
}
2626
```
2727

@@ -31,7 +31,7 @@ Or if you'd rather use the macro, to save you some writing:
3131
#[macro_use] extern crate assert_cli;
3232

3333
fn main() {
34-
assert_cmd!(echo "42").prints("42").unwrap();
34+
assert_cmd!(echo "42").stdout().contains("42").unwrap();
3535
}
3636
```
3737

@@ -45,21 +45,21 @@ fn main() {
4545
let test = assert_cmd!(ls "foo-bar-foo")
4646
.fails()
4747
.and()
48-
.prints_error("foo-bar-foo")
48+
.stderr().contains("foo-bar-foo")
4949
.execute();
5050
assert!(test.is_ok());
5151
}
5252
```
5353

5454
If you want to match the program's output _exactly_, you can use
55-
`prints_exactly`:
55+
`stdout().is`:
5656

5757
```rust,should_panic
5858
#[macro_use] extern crate assert_cli;
5959
6060
fn main() {
6161
assert_cmd!(wc "README.md")
62-
.prints_exactly("1337 README.md")
62+
.stdout().is("1337 README.md")
6363
.unwrap();
6464
}
6565
```

0 commit comments

Comments
 (0)