Skip to content

Commit

Permalink
Merge pull request #338 from epage/edit
Browse files Browse the repository at this point in the history
fix(filter): Don't stop redactin on first mismatch
  • Loading branch information
epage authored May 29, 2024
2 parents cddc713 + 7fe225d commit ee41d1c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
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

0 comments on commit ee41d1c

Please sign in to comment.