From 68cf663f772ec121dc1b85a0c17d97ef07d3d327 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Sat, 3 Jul 2021 12:07:03 -0500 Subject: [PATCH] chore: Update predicates --- Cargo.toml | 2 +- src/assert.rs | 12 ++++++------ tests/assert.rs | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7dc4e6a..23dd67e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ maintenance = { status = "passively-maintained" } name = "bin_fixture" [dependencies] -predicates = { version = "1.0", default-features = false, features = ["difference"] } +predicates = { version = "2.0", default-features = false, features = ["diff"] } predicates-core = "1.0" predicates-tree = "1.0" doc-comment = "0.3" diff --git a/src/assert.rs b/src/assert.rs index 9adc280..b6eae83 100644 --- a/src/assert.rs +++ b/src/assert.rs @@ -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: @@ -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: @@ -654,7 +654,7 @@ impl IntoCodePredicate 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") @@ -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) } } @@ -863,7 +863,7 @@ impl IntoOutputPredicate 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>( diff --git a/tests/assert.rs b/tests/assert.rs index c2727a4..ec852f5 100644 --- a/tests/assert.rs +++ b/tests/assert.rs @@ -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() @@ -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\n")); Command::cargo_bin("bin_fixture") .unwrap()