refactor(test): Remove dead 'expect_stdout_contains_n' check

This was missed when removing the assert
This commit is contained in:
Ed Page 2024-10-31 15:59:16 -05:00
parent 497c228763
commit 8a8254eb1f
2 changed files with 0 additions and 40 deletions

View File

@ -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.
///

View File

@ -649,7 +649,6 @@ pub struct Execs {
expect_stderr_data: Option<snapbox::Data>,
expect_stdout_contains: Vec<String>,
expect_stderr_contains: Vec<String>,
expect_stdout_contains_n: Vec<(String, usize)>,
expect_stdout_not_contains: Vec<String>,
expect_stderr_not_contains: Vec<String>,
expect_stdout_unordered: Vec<String>,
@ -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(),