Skip to content

Commit 6dff997

Browse files
committed
Remove with_either_contains.
It isn't needed anymore, and I would prefer to not keep around unused code. It can always be added back if ever needed again.
1 parent e132bb5 commit 6dff997

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ pub struct Execs {
475475
expect_exit_code: Option<i32>,
476476
expect_stdout_contains: Vec<String>,
477477
expect_stderr_contains: Vec<String>,
478-
expect_either_contains: Vec<String>,
479478
expect_stdout_contains_n: Vec<(String, usize)>,
480479
expect_stdout_not_contains: Vec<String>,
481480
expect_stderr_not_contains: Vec<String>,
@@ -540,15 +539,6 @@ impl Execs {
540539
self
541540
}
542541

543-
/// Verifies that either stdout or stderr contains the given contiguous
544-
/// lines somewhere in its output.
545-
///
546-
/// See [`compare`] for supported patterns.
547-
pub fn with_either_contains<S: ToString>(&mut self, expected: S) -> &mut Self {
548-
self.expect_either_contains.push(expected.to_string());
549-
self
550-
}
551-
552542
/// Verifies that stdout contains the given contiguous lines somewhere in
553543
/// its output, and should be repeated `number` times.
554544
///
@@ -806,7 +796,6 @@ impl Execs {
806796
&& self.expect_stderr.is_none()
807797
&& self.expect_stdout_contains.is_empty()
808798
&& self.expect_stderr_contains.is_empty()
809-
&& self.expect_either_contains.is_empty()
810799
&& self.expect_stdout_contains_n.is_empty()
811800
&& self.expect_stdout_not_contains.is_empty()
812801
&& self.expect_stderr_not_contains.is_empty()
@@ -917,23 +906,6 @@ impl Execs {
917906
for expect in self.expect_stderr_unordered.iter() {
918907
compare::match_unordered(expect, stderr, cwd)?;
919908
}
920-
for expect in self.expect_either_contains.iter() {
921-
let match_std = compare::match_contains(expect, stdout, cwd);
922-
let match_err = compare::match_contains(expect, stderr, cwd);
923-
if let (Err(_), Err(_)) = (match_std, match_err) {
924-
bail!(
925-
"expected to find:\n\
926-
{}\n\n\
927-
did not find in either output.
928-
--- stdout\n{}\n
929-
--- stderr\n{}\n",
930-
expect,
931-
stdout,
932-
stderr,
933-
);
934-
}
935-
}
936-
937909
for (with, without) in self.expect_stderr_with_without.iter() {
938910
compare::match_with_without(stderr, with, without, cwd)?;
939911
}
@@ -967,7 +939,6 @@ pub fn execs() -> Execs {
967939
expect_exit_code: Some(0),
968940
expect_stdout_contains: Vec::new(),
969941
expect_stderr_contains: Vec::new(),
970-
expect_either_contains: Vec::new(),
971942
expect_stdout_contains_n: Vec::new(),
972943
expect_stdout_not_contains: Vec::new(),
973944
expect_stderr_not_contains: Vec::new(),

tests/testsuite/bench.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,12 @@ fn cargo_bench_failing_test() {
346346
[FINISHED] bench [optimized] target(s) in [..]
347347
[RUNNING] [..] (target/release/deps/foo-[..][EXE])",
348348
)
349-
.with_either_contains(
349+
.with_stdout_contains(
350350
"[..]thread '[..]' panicked at 'assertion failed: `(left == right)`[..]",
351351
)
352-
.with_either_contains("[..]left: `\"hello\"`[..]")
353-
.with_either_contains("[..]right: `\"nope\"`[..]")
354-
.with_either_contains("[..]src/main.rs:15[..]")
352+
.with_stdout_contains("[..]left: `\"hello\"`[..]")
353+
.with_stdout_contains("[..]right: `\"nope\"`[..]")
354+
.with_stdout_contains("[..]src/main.rs:15[..]")
355355
.with_status(101)
356356
.run();
357357
}

0 commit comments

Comments
 (0)