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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: assert-rs/assert_cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.5.1
Choose a base ref
...
head repository: assert-rs/assert_cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 1,427 additions and 310 deletions.
  1. +11 −0 .github/ISSUE_TEMPLATE.md
  2. +13 −0 .github/PULL_REQUEST_TEMPLATE.md
  3. +12 −4 .travis.yml
  4. +32 −0 CONTRIBUTING.md
  5. +14 −12 Cargo.toml
  6. +12 −74 README.md
  7. 0 README.md.skt.md
  8. +0 −5 build.rs
  9. +0 −1 rustfmt.toml
  10. +453 −70 src/assert.rs
  11. +36 −0 src/bin/assert_fixture.rs
  12. +60 −30 src/diff.rs
  13. +206 −40 src/errors.rs
  14. +15 −5 src/lib.rs
  15. +10 −17 src/macros.rs
  16. +524 −51 src/output.rs
  17. +23 −0 tests/cargo.rs
  18. +6 −0 tests/docmatic.rs
  19. +0 −1 tests/skeptic.rs
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!--
Hi! If you want to report a bug, request a feature, or ask a question on how to
use assert_cli, you have come to the right place!
If you want to report a bug, please fill in the following. Otherwise, feel free
to remove these lines.
-->

- `assert_cli` version:
- Rust version:
- OS and version:
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--
Thank you for taking the time to contribute to this project!
To ease reviewing your changes and making sure we don't forget anything, please
take a minute to check the following (remove lines that don't apply), and
replace this text with a description of what this PR does. Bonus points for
linking to issues! :)
-->

- [ ] I have created tests for any new feature, or added regression tests for bugfixes.
- [ ] `cargo test` succeeds
- [ ] Clippy is happy: `cargo +nightly clippy` succeeds
- [ ] Rustfmt is happy: `cargo +nightly fmt` succeeds
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -7,11 +7,19 @@ rust:
- nightly
matrix:
include:
- rust: nightly-2017-03-15
env: CLIPPY=YESPLEASE
- rust: nightly-2017-10-09
env: CLIPPY_VERS="0.0.165"
before_script: |
[[ "$(cargo +nightly-2017-10-09 clippy --version)" != "$CLIPPY_VERS" ]] && \
cargo +nightly-2017-10-09 install clippy --vers "$CLIPPY_VERS" --force || true
script: |
cargo +nightly-2017-03-15 install clippy --vers "0.0.120"
cargo +nightly-2017-03-15 clippy
cargo +nightly-2017-10-09 clippy -- -D warnings
- rust: 1.24.0 # `stable`: Locking down for consistent behavior
env: RUSTFMT
install:
- rustup component add rustfmt-preview
script:
- cargo fmt -- --write-mode=diff
before_script:
- |
pip install 'travis-cargo<0.2' --user &&
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Thanks for wanting to contribute!

Feel free to create issues or make pull requests, we'll try to quickly review them.

If you need to reach out to us, find a relevant [issue][Issues] or open a new one.

# Pull Requests

## Project Ideas

If you're looking for things to do check out the [open issues][Issues].
Or take a grep through [all TODO comments][TODO] in the code and feel free to help us out there!

## Best Practices

We appreciate your help as-is. We'd love to help you through the process for contributing. We have some suggestions to help make things go more smoothly.

Before spending too much time on a PR, consider opening an issue so we can make sure we're aligned on how the problem should be solved.

# Releasing

When we're ready to release, a project owner should do the following
- Determine what the next version is, according to semver
- Update the version in `Cargo.toml` and in the `README.md` and commit
- Run `git tag v<X>.<Y>.<Z>`
- Push all of this to `master`
- Create a github release
- Identify what fixes, features, and breaking changes are in the release.
- Run `cargo publish` (run `cargo login` first if needed)

[Issues]: https://github.com/assert-rs/assert_cli/issues
[TODO]: https://github.com/assert-rs/assert_cli/search?q=TODO
26 changes: 14 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
[package]
name = "assert_cli"
version = "0.5.1"
version = "0.6.3"
description = "Test CLI Applications."
authors = ["Pascal Hertleif <killercup@gmail.com>"]
authors = ["Pascal Hertleif <killercup@gmail.com>", "Ed Page <eopage@gmail.com>"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/killercup/assert_cli.git"
homepage = "https://github.com/killercup/assert_cli"
repository = "https://github.com/assert-rs/assert_cli.git"
homepage = "https://github.com/assert-rs/assert_cli"
documentation = "http://docs.rs/assert_cli/"
readme = "README.md"
categories = ["development-tools::testing"]
keywords = ["cli", "testing", "assert"]
build = "build.rs"

[[bin]]
name = "assert_fixture"

[dependencies]
colored = "1.5"
difference = "1.0"
error-chain = "0.11"
difference = "2.0"
failure = "0.1"
failure_derive = "0.1"
serde_json = "1.0"

[build-dependencies]
skeptic = "0.13"
environment = "0.1"

[dev-dependencies]
skeptic = "0.13"
docmatic = "0.1"

[badges]
travis-ci = { repository = "killercup/assert_cli" }
travis-ci = { repository = "assert-rs/assert_cli" }
maintenance = { status = "deprecated" }
86 changes: 12 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,81 +2,15 @@

> **Test CLI Applications** - This crate checks the output of a child process is as expected.
[![Build Status](https://travis-ci.org/killercup/assert_cli.svg)](https://travis-ci.org/killercup/assert_cli) [![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation]
[![Build Status](https://travis-ci.org/assert-rs/assert_cli.svg)][Travis]
[![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation]
![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].

Just add it to your `Cargo.toml`:

```toml
[dependencies]
assert_cli = "0.5"
```

## Example

Here's a trivial example:

```rust
extern crate assert_cli;

fn main() {
assert_cli::Assert::command(&["echo", "42"]).stdout().contains("42").unwrap();
}
```

Or if you'd rather use the macro, to save you some writing:

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

fn main() {
assert_cmd!(echo "42").stdout().contains("42").unwrap();
}
```

And here is one that will fail (which also shows `execute` which returns a
`Result` and can be used instead of `unwrap`):

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

fn main() {
let test = assert_cmd!(ls "foo-bar-foo")
.fails()
.and()
.stderr().contains("foo-bar-foo")
.execute();
assert!(test.is_ok());
}
```

If you want to match the program's output _exactly_, you can use
`stdout().is`:

```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")`.

More detailed information is available in the [documentation]. :-)
Stayed tuned to [Issue #41][future] for our reinventing `assert_cli` on top of `assert_cmd`.

## License

@@ -94,4 +28,8 @@ submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.

[Documentation]: http://killercup.github.io/assert_cli/
[Travis]: https://travis-ci.org/assert-rs/assert_cli
[Crates.io]: https://crates.io/crates/assert_cli
[Documentation]: https://docs.rs/assert_cli
[assert_cmd]: https://crates.io/crates/assert_cmd
[future]: https://github.com/assert-rs/assert_cli/issues/41
Empty file removed README.md.skt.md
Empty file.
5 changes: 0 additions & 5 deletions build.rs

This file was deleted.

1 change: 0 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
format_strings = false
reorder_imports = true

Loading