From e11d1722bb6e1e58c91adb1964993c74b45f4293 Mon Sep 17 00:00:00 2001 From: d1t2 Date: Wed, 19 Jun 2024 11:45:12 +0800 Subject: [PATCH] test: Auto-redact file number --- crates/cargo-test-support/src/compare.rs | 5 +++++ tests/testsuite/alt_registry.rs | 6 +++--- tests/testsuite/artifact_dep.rs | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/cargo-test-support/src/compare.rs b/crates/cargo-test-support/src/compare.rs index 9a7f93bc557..0058d2c77a7 100644 --- a/crates/cargo-test-support/src/compare.rs +++ b/crates/cargo-test-support/src/compare.rs @@ -164,6 +164,11 @@ fn add_common_redactions(subs: &mut snapbox::Redactions) { regex!("; finished in (?[0-9]+(\\.[0-9]+))s"), ) .unwrap(); + subs.insert( + "[FILE_NUM]", + regex!(r"\[(PACKAGED|REMOVED|SUMMARY)\] (?[0-9]+) files"), + ) + .unwrap(); subs.insert( "[FILE_SIZE]", regex!("(?[0-9]+(\\.[0-9]+)([a-zA-Z]i)?)B"), diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs index 3bb54448d2c..42cf24f8147 100644 --- a/tests/testsuite/alt_registry.rs +++ b/tests/testsuite/alt_registry.rs @@ -346,7 +346,7 @@ fn publish_with_registry_dependency() { See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [PACKAGING] foo v0.0.1 ([ROOT]/foo) [UPDATING] `alternative` index -[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[PACKAGED] [FILE_NUM] files, [FILE_SIZE]B ([FILE_SIZE]B compressed) [VERIFYING] foo v0.0.1 ([ROOT]/foo) [DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.1 (registry `alternative`) @@ -512,7 +512,7 @@ fn publish_to_alt_registry() { [WARNING] manifest has no description, license, license-file, documentation, homepage or repository. See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [PACKAGING] foo v0.0.1 ([ROOT]/foo) -[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[PACKAGED] [FILE_NUM] files, [FILE_SIZE]B ([FILE_SIZE]B compressed) [VERIFYING] foo v0.0.1 ([ROOT]/foo) [COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -591,7 +591,7 @@ fn publish_with_crates_io_dep() { See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [PACKAGING] foo v0.0.1 ([ROOT]/foo) [UPDATING] `dummy-registry` index -[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[PACKAGED] [FILE_NUM] files, [FILE_SIZE]B ([FILE_SIZE]B compressed) [VERIFYING] foo v0.0.1 ([ROOT]/foo) [DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.1 (registry `dummy-registry`) diff --git a/tests/testsuite/artifact_dep.rs b/tests/testsuite/artifact_dep.rs index 22d35f781c8..bf220e34093 100644 --- a/tests/testsuite/artifact_dep.rs +++ b/tests/testsuite/artifact_dep.rs @@ -2200,7 +2200,7 @@ fn publish_artifact_dep() { .with_stderr_data(str![[r#" [UPDATING] crates.io index [PACKAGING] foo v0.1.0 ([ROOT]/foo) -[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[PACKAGED] [FILE_NUM] files, [FILE_SIZE]B ([FILE_SIZE]B compressed) [UPLOADING] foo v0.1.0 ([ROOT]/foo) [UPLOADED] foo v0.1.0 to registry `crates-io` [NOTE] waiting for `foo v0.1.0` to be available at registry `crates-io`.