Skip to content

Commit

Permalink
test: auto-redact elapsed time from libtest output
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Jun 11, 2024
1 parent a9ee3e8 commit c5a6a6c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/cargo-test-support/src/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ pub fn assert_ui() -> snapbox::Assert {
regex::Regex::new("Finished.*in (?<redacted>[0-9]+(\\.[0-9]+))s").unwrap(),
)
.unwrap();
// output from libtest
subs.insert(
"[ELAPSED]",
regex::Regex::new("; finished in (?<redacted>[0-9]+(\\.[0-9]+))s").unwrap(),
)
.unwrap();
subs.insert(
"[FILE_SIZE]",
regex::Regex::new("(?<redacted>[0-9]+(\\.[0-9]+)([a-zA-Z]i)?)B").unwrap(),
Expand Down Expand Up @@ -156,6 +162,12 @@ pub fn assert_e2e() -> snapbox::Assert {
regex::Regex::new("[FINISHED].*in (?<redacted>[0-9]+(\\.[0-9]+))s").unwrap(),
)
.unwrap();
// output from libtest
subs.insert(
"[ELAPSED]",
regex::Regex::new("; finished in (?<redacted>[0-9]+(\\.[0-9]+))s").unwrap(),
)
.unwrap();
subs.insert(
"[FILE_SIZE]",
regex::Regex::new("(?<redacted>[0-9]+(\\.[0-9]+)([a-zA-Z]i)?)B").unwrap(),
Expand Down

0 comments on commit c5a6a6c

Please sign in to comment.