Skip to content

Commit

Permalink
test(test): Verify elapsed redaction
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 10, 2024
1 parent a10b3ca commit 5ed6392
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/cargo-test-support/src/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,10 @@ impl fmt::Debug for WildStr<'_> {

#[cfg(test)]
mod test {
use snapbox::assert_data_eq;
use snapbox::prelude::*;
use snapbox::str;

use super::*;

#[test]
Expand Down Expand Up @@ -960,4 +964,19 @@ B", false,
false,
);
}

#[test]
fn redact_elapsed_time() {
let mut subs = snapbox::Redactions::new();
add_regex_redactions(&mut subs);

assert_data_eq!(
subs.redact("[FINISHED] `release` profile [optimized] target(s) in 5.5s"),
str!["[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s"].raw()
);
assert_data_eq!(
subs.redact("[FINISHED] `release` profile [optimized] target(s) in 1m 05s"),
str!["[FINISHED] `release` profile [optimized] target(s) in 1m 05s"].raw()
);
}
}

0 comments on commit 5ed6392

Please sign in to comment.