diff --git a/crates/cargo-test-support/src/compare.rs b/crates/cargo-test-support/src/compare.rs index 3dba1a2849f..36bbb2aedab 100644 --- a/crates/cargo-test-support/src/compare.rs +++ b/crates/cargo-test-support/src/compare.rs @@ -531,40 +531,6 @@ pub(crate) fn match_does_not_contain( } } -/// Checks that the given string contains the given contiguous lines -/// somewhere, and should be repeated `number` times. -/// -/// See [Patterns](index.html#patterns) for more information on pattern matching. -pub(crate) fn match_contains_n( - expected: &str, - number: usize, - actual: &str, - cwd: Option<&Path>, -) -> Result<()> { - let expected = normalize_expected(expected, cwd); - let actual = normalize_actual(actual, cwd); - let e: Vec<_> = expected.lines().map(|line| WildStr::new(line)).collect(); - let a: Vec<_> = actual.lines().map(|line| WildStr::new(line)).collect(); - if e.len() == 0 { - bail!("expected length must not be zero"); - } - let matches = a.windows(e.len()).filter(|window| *window == e).count(); - if matches == number { - Ok(()) - } else { - bail!( - "expected to find {} occurrences of:\n\ - {}\n\n\ - but found {} matches in the output:\n\ - {}", - number, - expected, - matches, - actual - ) - } -} - /// Checks that the given string has a line that contains the given patterns, /// and that line also does not contain the `without` patterns. /// diff --git a/crates/cargo-test-support/src/lib.rs b/crates/cargo-test-support/src/lib.rs index 689f7208cf4..b779f5605e7 100644 --- a/crates/cargo-test-support/src/lib.rs +++ b/crates/cargo-test-support/src/lib.rs @@ -649,7 +649,6 @@ pub struct Execs { expect_stderr_data: Option, expect_stdout_contains: Vec, expect_stderr_contains: Vec, - expect_stdout_contains_n: Vec<(String, usize)>, expect_stdout_not_contains: Vec, expect_stderr_not_contains: Vec, expect_stdout_unordered: Vec, @@ -992,7 +991,6 @@ impl Execs { && self.expect_stderr_data.is_none() && self.expect_stdout_contains.is_empty() && self.expect_stderr_contains.is_empty() - && self.expect_stdout_contains_n.is_empty() && self.expect_stdout_not_contains.is_empty() && self.expect_stderr_not_contains.is_empty() && self.expect_stdout_unordered.is_empty() @@ -1103,9 +1101,6 @@ impl Execs { for expect in self.expect_stderr_contains.iter() { compare::match_contains(expect, stderr, cwd)?; } - for &(ref expect, number) in self.expect_stdout_contains_n.iter() { - compare::match_contains_n(expect, number, stdout, cwd)?; - } for expect in self.expect_stdout_not_contains.iter() { compare::match_does_not_contain(expect, stdout, cwd)?; } @@ -1144,7 +1139,6 @@ pub fn execs() -> Execs { expect_stderr_data: None, expect_stdout_contains: Vec::new(), expect_stderr_contains: Vec::new(), - expect_stdout_contains_n: Vec::new(), expect_stdout_not_contains: Vec::new(), expect_stderr_not_contains: Vec::new(), expect_stdout_unordered: Vec::new(),