From ed027736e7cc6828a4aac91ece1843c7dd311aba Mon Sep 17 00:00:00 2001 From: d1t2 Date: Wed, 26 Jun 2024 23:28:17 +0800 Subject: [PATCH] test: Allow redact file size w/o fraction `cargo clean` shows file size without fraction in summary when the size is lower than 1024. And we need to avoid matching things like `%2B%23..` found in other test cases, the trailing `\s` is added to regex. --- crates/cargo-test-support/src/compare.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cargo-test-support/src/compare.rs b/crates/cargo-test-support/src/compare.rs index 5b396c410..b7c3bc658 100644 --- a/crates/cargo-test-support/src/compare.rs +++ b/crates/cargo-test-support/src/compare.rs @@ -171,7 +171,7 @@ fn add_common_redactions(subs: &mut snapbox::Redactions) { .unwrap(); subs.insert( "[FILE_SIZE]", - regex!(r"(?[0-9]+(\.[0-9]+)([a-zA-Z]i)?)B"), + regex!(r"(?[0-9]+(\.[0-9]+)?([a-zA-Z]i)?)B\s"), ) .unwrap(); subs.insert(