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(filter): Don't stop redactin on first mismatch #338

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/snapbox/src/assert/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl Backtrace {

#[cfg(not(feature = "debug"))]
impl std::fmt::Display for Backtrace {
fn fmt(&self, _: &mut std::fmt::Formatter) -> std::fmt::Result {
fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Ok(())
}
}
5 changes: 3 additions & 2 deletions crates/snapbox/src/filter/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,9 @@ fn normalize_str_to_redactions(input: &str, pattern: &str, redactions: &Redactio
input_index += 1;
normalized.push(pattern_line);
} else {
// Give up doing further normalization
break;
// Skip this line and keep processing
input_index += 1;
normalized.push(input_line);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/snapbox/src/filter/test_redactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn str_normalize_post_elide_diverge() {
fn str_normalize_post_diverge_elide() {
let input = "Hello\nWorld\nGoodbye\nSir";
let pattern = "Hello\nMoon\nGoodbye\n...";
let expected = "Hello\nWorld\nGoodbye\nSir";
let expected = "Hello\nWorld\nGoodbye\n...";
let actual = NormalizeToExpected::new()
.redact()
.normalize(input.into(), &pattern.into());
Expand Down
Loading