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

Mark assert_cli as deprecated #117

Merged
merged 1 commit into from
Jul 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ docmatic = "0.1"

[badges]
travis-ci = { repository = "assert-rs/assert_cli" }
maintenance = { status = "deprecated" }
78 changes: 5 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,10 @@
![License](https://img.shields.io/crates/l/assert_cli.svg)
[![crates.io](https://img.shields.io/crates/v/assert_cli.svg)][Crates.io]

## Install
Note: `assert_cli`, in its current form, is deprecated. The spiritual
successor to `assert_cli` is [`assert_cmd`][assert_cmd].

For your tests, add it to your `Cargo.toml`:

```toml
[dev-dependencies]
assert_cli = "0.6"
```

## Example

Here's a trivial example:

```rust,ignore
extern crate assert_cli;

fn main() {
assert_cli::Assert::main_binary().unwrap();
}
```

And here is one that will fail (and demonstrates running arbitrary commands):

```rust
extern crate assert_cli;

fn main() {
assert_cli::Assert::command(&["ls", "foo-bar-foo"])
.fails()
.and()
.stderr().contains("foo-bar-foo")
.unwrap();
}
```

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

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

fn main() {
assert_cmd!(wc "README.md")
.stdout().is("1337 README.md")
.unwrap();
}
```

... which has the benefit to show a nice, colorful diff in your terminal,
like this:

```diff
-1337
+92
```

**Tip**: Enclose arguments in the `assert_cmd!` macro in quotes `"`,
if there are special characters, which the macro doesn't accept, e.g.
`assert_cmd!(cat "foo.txt")`.

Assert Cli use [Environment][Environment] underneath to deal with environment variables.

More detailed information is available in the [documentation]. :-)

## Relevant crates

Other crates that might be useful in testing command line programs.
* [dir-diff][dir-diff] for testing file side-effects.
* [tempfile][tempfile] for scratchpad directories.
* [duct][duct] for orchestrating multiple processes.
Stayed tuned to [Issue #41][future] for our reinventing `assert_cli` on top of `assert_cmd`.

## License

Expand All @@ -97,7 +31,5 @@ conditions.
[Travis]: https://travis-ci.org/assert-rs/assert_cli
[Crates.io]: https://crates.io/crates/assert_cli
[Documentation]: https://docs.rs/assert_cli
[Environment]: https://github.com/Freyskeyd/environment
[dir-diff]: https://crates.io/crates/dir-diff
[tempfile]: https://crates.io/crates/tempfile
[duct]: https://crates.io/crates/duct
[assert_cmd]: https://crates.io/crates/assert_cmd
[future]: https://github.com/assert-rs/assert_cli/issues/41