Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(diff): Remove duplicated output #122

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
<!-- next-header -->
## [Unreleased] - ReleaseDate

#### Breaking Changes

- `predicates::str::diff` was removed
- `predicates::str::similar` was renamed to `diff`
- The `difference` feature flag was renamed to `diff`
- `diff().split` and `diff().distance` were removed

#### Fixes

- Shrink the output of Diffs because its redundant
- Moved off of an unmaintained Diff library

## [1.0.4] - 2021-05-12

#### Features
Expand Down
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ maintenance = { status = "passively-maintained" }
name = "bin_fixture"

[dependencies]
predicates = { version = "1.0", default-features = false, features = ["difference"] }
predicates-core = "1.0"
predicates-tree = "1.0"
predicates = { version = "1.0", default-features = false, features = ["diff"], path="../predicates-rs" }
predicates-core = {version="1.0", path="../predicates-rs/crates/core" }
predicates-tree = {version="1.0", path="../predicates-rs/crates/tree" }

doc-comment = "0.3"
wait-timeout = "0.2.0"
bstr = "0.2.14"
Expand Down
12 changes: 6 additions & 6 deletions src/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ impl Assert {
/// .env("stdout", "hello")
/// .env("stderr", "world")
/// .assert()
/// .stdout(predicate::str::similar("hello\n"));
/// .stdout(predicate::str::diff("hello\n"));
/// ```
///
/// Accepting bytes:
Expand Down Expand Up @@ -379,7 +379,7 @@ impl Assert {
/// .env("stdout", "hello")
/// .env("stderr", "world")
/// .assert()
/// .stderr(predicate::str::similar("world\n"));
/// .stderr(predicate::str::diff("world\n"));
/// ```
///
/// Accepting bytes:
Expand Down Expand Up @@ -654,7 +654,7 @@ impl IntoCodePredicate<InCodePredicate> for &'static [i32] {
/// .env("stdout", "hello")
/// .env("stderr", "world")
/// .assert()
/// .stdout(predicate::str::similar("hello\n").from_utf8());
/// .stdout(predicate::str::diff("hello\n").from_utf8());
///
/// // which can be shortened to:
/// Command::cargo_bin("bin_fixture")
Expand Down Expand Up @@ -785,12 +785,12 @@ pub struct StrContentOutputPredicate(

impl StrContentOutputPredicate {
pub(crate) fn from_str(value: &'static str) -> Self {
let pred = predicates::str::similar(value).from_utf8();
let pred = predicates::str::diff(value).from_utf8();
StrContentOutputPredicate(pred)
}

pub(crate) fn from_string(value: String) -> Self {
let pred = predicates::str::similar(value).from_utf8();
let pred = predicates::str::diff(value).from_utf8();
StrContentOutputPredicate(pred)
}
}
Expand Down Expand Up @@ -862,7 +862,7 @@ impl IntoOutputPredicate<StrContentOutputPredicate> for &'static str {
/// .env("stdout", "hello")
/// .env("stderr", "world")
/// .assert()
/// .stderr(predicate::str::similar("world\n"));
/// .stderr(predicate::str::diff("world\n"));
/// ```
#[derive(Debug, Clone)]
pub struct StrOutputPredicate<P: predicates_core::Predicate<str>>(
Expand Down
4 changes: 2 additions & 2 deletions tests/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn stdout_example() {
.env("stdout", "hello")
.env("stderr", "world")
.assert()
.stdout(predicate::str::similar("hello\n"));
.stdout(predicate::str::diff("hello\n"));

Command::cargo_bin("bin_fixture")
.unwrap()
Expand Down Expand Up @@ -131,7 +131,7 @@ fn stderr_example() {
.env("stdout", "hello")
.env("stderr", "world")
.assert()
.stderr(predicate::str::similar("world\n"));
.stderr(predicate::str::diff("world foo\n"));

Command::cargo_bin("bin_fixture")
.unwrap()
Expand Down