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

Commit ed55583

Browse files
committed
docs: Make main_binary front and center
The README was changed to progressively show how to launch a binary, starting with `main_binary`. Sadly, `main_binary` needs to be skipped because skeptic has the cargo stuff locked. `execute` was removed from the README since it seemed like a lesser use case. Fixes #61
1 parent 204d0a8 commit ed55583

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

README.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,30 @@ assert_cli = "0.5"
1717

1818
Here's a trivial example:
1919

20-
```rust
20+
```rust,ignore
2121
extern crate assert_cli;
2222
2323
fn main() {
24-
assert_cli::Assert::command(&["echo", "42"]).stdout().contains("42").unwrap();
25-
}
26-
```
27-
28-
Or if you'd rather use the macro, to save you some writing:
29-
30-
```rust
31-
#[macro_use] extern crate assert_cli;
32-
33-
fn main() {
34-
assert_cmd!(echo "42").stdout().contains("42").unwrap();
24+
assert_cli::Assert::main_binary().unwrap();
3525
}
3626
```
3727

38-
And here is one that will fail (which also shows `execute` which returns a
39-
`Result` and can be used instead of `unwrap`):
28+
And here is one that will fail (and demonstrates running arbitrary commands):
4029

4130
```rust
42-
#[macro_use] extern crate assert_cli;
31+
extern crate assert_cli;
4332

4433
fn main() {
45-
let test = assert_cmd!(ls "foo-bar-foo")
34+
assert_cli::Assert::command(&["ls", "foo-bar-foo"])
4635
.fails()
4736
.and()
4837
.stderr().contains("foo-bar-foo")
49-
.execute();
50-
assert!(test.is_ok());
38+
.unwrap();
5139
}
5240
```
5341

5442
If you want to match the program's output _exactly_, you can use
55-
`stdout().is`:
43+
`stdout().is` (and shows the macro form of `command`):
5644

5745
```rust,should_panic
5846
#[macro_use] extern crate assert_cli;

0 commit comments

Comments
 (0)