Skip to content

Commit 5ed6392

Browse files
committed
test(test): Verify elapsed redaction
1 parent a10b3ca commit 5ed6392

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

crates/cargo-test-support/src/compare.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,10 @@ impl fmt::Debug for WildStr<'_> {
832832

833833
#[cfg(test)]
834834
mod test {
835+
use snapbox::assert_data_eq;
836+
use snapbox::prelude::*;
837+
use snapbox::str;
838+
835839
use super::*;
836840

837841
#[test]
@@ -960,4 +964,19 @@ B", false,
960964
false,
961965
);
962966
}
967+
968+
#[test]
969+
fn redact_elapsed_time() {
970+
let mut subs = snapbox::Redactions::new();
971+
add_regex_redactions(&mut subs);
972+
973+
assert_data_eq!(
974+
subs.redact("[FINISHED] `release` profile [optimized] target(s) in 5.5s"),
975+
str!["[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s"].raw()
976+
);
977+
assert_data_eq!(
978+
subs.redact("[FINISHED] `release` profile [optimized] target(s) in 1m 05s"),
979+
str!["[FINISHED] `release` profile [optimized] target(s) in 1m 05s"].raw()
980+
);
981+
}
963982
}

0 commit comments

Comments
 (0)