From e673802c38e1723880b8d9fbddea35a12af430c0 Mon Sep 17 00:00:00 2001 From: todd Date: Tue, 22 Oct 2024 23:00:33 +0800 Subject: [PATCH] test: update message snapshots to align with new error message --- tests/testsuite/build.rs | 2 +- tests/testsuite/directory.rs | 4 ++-- tests/testsuite/local_registry.rs | 2 +- tests/testsuite/offline.rs | 29 +++++++++++++++++--------- tests/testsuite/package.rs | 12 +++++------ tests/testsuite/publish.rs | 2 +- tests/testsuite/registry.rs | 34 +++++++++++++++---------------- tests/testsuite/update.rs | 6 +++--- 8 files changed, 50 insertions(+), 41 deletions(-) diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index b7c87615437..8031cbd9c6b 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -6043,7 +6043,7 @@ fn avoid_dev_deps() { .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `baz` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `bar v0.1.0 ([ROOT]/foo)` "#]]) diff --git a/tests/testsuite/directory.rs b/tests/testsuite/directory.rs index 1db19eeb655..a9a8324b8b0 100644 --- a/tests/testsuite/directory.rs +++ b/tests/testsuite/directory.rs @@ -199,7 +199,7 @@ Caused by: no matching package found searched package name: `baz` perhaps you meant: bar or foo - location searched: registry `crates-io` + location searched: directory source `[ROOT]/index` (which is replacing registry `crates-io`) required by package `bar v0.1.0` "#]]) @@ -283,7 +283,7 @@ fn not_there() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: directory source `[ROOT]/index` (which is replacing registry `crates-io`) required by package `foo v0.1.0 ([ROOT]/foo)` "#]]) diff --git a/tests/testsuite/local_registry.rs b/tests/testsuite/local_registry.rs index 0405ee8763d..a5ddcb48da1 100644 --- a/tests/testsuite/local_registry.rs +++ b/tests/testsuite/local_registry.rs @@ -101,7 +101,7 @@ fn not_found() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no matching package named `baz` found -location searched: registry `crates-io` +location searched: `[ROOT]/registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]]) diff --git a/tests/testsuite/offline.rs b/tests/testsuite/offline.rs index 19116f9fc7a..e046915a01b 100644 --- a/tests/testsuite/offline.rs +++ b/tests/testsuite/offline.rs @@ -184,7 +184,7 @@ fn cargo_compile_offline_not_try_update() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no matching package named `not_cached_dep` found -location searched: registry `crates-io` +location searched: crates.io index required by package `bar v0.1.0 ([ROOT]/bar)` As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag. @@ -195,7 +195,7 @@ As a reminder, you're using offline mode (--offline) which can sometimes cause s p.change_file(".cargo/config.toml", "net.offline = true"); p.cargo("check").with_status(101).with_stderr_data(str![[r#" [ERROR] no matching package named `not_cached_dep` found -location searched: registry `crates-io` +location searched: crates.io index required by package `bar v0.1.0 ([ROOT]/bar)` As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag. @@ -366,7 +366,7 @@ Caused by: .run(); } -fn update_offline_not_cached() { +fn update_offline_not_cached(is_registry_set: bool) { let p = project() .file( "Cargo.toml", @@ -383,30 +383,39 @@ fn update_offline_not_cached() { ) .file("src/main.rs", "fn main() {}") .build(); + + let location_searched_message; + if is_registry_set { + location_searched_message = + "`dummy-registry` index (which is replacing registry `crates-io`)"; + } else { + location_searched_message = "crates.io index" + } + p.cargo("update --offline") .with_status(101) - .with_stderr_data( + .with_stderr_data(&format!( "\ [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: {location_searched_message} required by package `foo v0.0.1 ([ROOT]/foo)` As a reminder, you're using offline mode (--offline) which can sometimes cause \ surprising resolution failures, if this error is too confusing you may wish to \ retry without the offline flag. -", - ) +" + )) .run(); } #[cargo_test] fn update_offline_not_cached_sparse() { let _registry = RegistryBuilder::new().http_index().build(); - update_offline_not_cached() + update_offline_not_cached(true) } #[cargo_test] fn update_offline_not_cached_git() { - update_offline_not_cached() + update_offline_not_cached(false) } #[cargo_test] @@ -756,7 +765,7 @@ fn main(){ .with_stderr_data( str![[r#" [ERROR] no matching package named `present_dep` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.1.0 ([ROOT]/foo)` As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag. diff --git a/tests/testsuite/package.rs b/tests/testsuite/package.rs index 3984d5dae4f..e54d3a864e1 100644 --- a/tests/testsuite/package.rs +++ b/tests/testsuite/package.rs @@ -5312,7 +5312,7 @@ fn workspace_with_local_deps() { Caused by: no matching package named `level2` found - location searched: registry `crates-io` + location searched: crates.io index required by package `level1 v0.0.1 ([ROOT]/foo/level1)` "#]]) @@ -5496,7 +5496,7 @@ fn workspace_with_local_deps_packaging_one_fails() { Caused by: no matching package named `level2` found - location searched: registry `crates-io` + location searched: crates.io index required by package `level1 v0.0.1 ([ROOT]/foo/target/package/level1-0.0.1)` "#]]) @@ -5523,7 +5523,7 @@ fn workspace_with_local_deps_packaging_one_fails_nightly() { Caused by: no matching package named `level2` found - location searched: registry `crates-io` + location searched: crates.io index required by package `level1 v0.0.1 ([ROOT]/foo/target/package/level1-0.0.1)` "#]]) @@ -5589,7 +5589,7 @@ fn workspace_with_local_deps_packaging_one_bin_fails() { Caused by: no matching package named `level2` found - location searched: registry `crates-io` + location searched: crates.io index required by package `level1 v0.0.1 ([ROOT]/foo/level1)` "#]]) @@ -5809,7 +5809,7 @@ fn workspace_with_local_deps_index_mismatch() { Caused by: no matching package named `level2` found - location searched: registry `crates-io` + location searched: crates.io index required by package `level1 v0.0.1 ([ROOT]/foo/level1)` "#]]) @@ -6620,7 +6620,7 @@ fn unpublishable_dependency() { Caused by: no matching package named `dep` found - location searched: registry `alternative` + location searched: `alternative` index required by package `main v0.0.1 ([ROOT]/foo/main)` "#]]) diff --git a/tests/testsuite/publish.rs b/tests/testsuite/publish.rs index 88e78fae154..18fd5ebdef7 100644 --- a/tests/testsuite/publish.rs +++ b/tests/testsuite/publish.rs @@ -3932,7 +3932,7 @@ fn workspace_missing_dependency() { Caused by: no matching package named `a` found - location searched: registry `crates-io` + location searched: crates.io index required by package `b v0.0.1 ([ROOT]/foo/target/package/b-0.0.1)` "#]]) diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index e43e3c9dcde..193e093bbeb 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -167,7 +167,7 @@ fn nonexistent_http() { nonexistent(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `nonexistent` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]]); @@ -178,7 +178,7 @@ fn nonexistent_git() { nonexistent(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `nonexistent` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]]); @@ -218,7 +218,7 @@ fn wrong_case_http() { [ERROR] no matching package found searched package name: `Init` perhaps you meant: init -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]]); @@ -231,7 +231,7 @@ fn wrong_case_git() { [ERROR] no matching package found searched package name: `Init` perhaps you meant: init -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]]); @@ -272,7 +272,7 @@ fn mis_hyphenated_http() { [ERROR] no matching package found searched package name: `mis_hyphenated` perhaps you meant: mis-hyphenated -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]]); @@ -285,7 +285,7 @@ fn mis_hyphenated_git() { [ERROR] no matching package found searched package name: `mis_hyphenated` perhaps you meant: mis-hyphenated -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]]); @@ -468,7 +468,7 @@ fn update_registry_http() { str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `notyet` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]], @@ -491,7 +491,7 @@ fn update_registry_git() { str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `notyet` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]], @@ -551,7 +551,7 @@ fn package_with_path_deps_http() { Caused by: no matching package named `notyet` found - location searched: registry `crates-io` + location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]], @@ -580,7 +580,7 @@ fn package_with_path_deps_git() { Caused by: no matching package named `notyet` found - location searched: registry `crates-io` + location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]], @@ -925,7 +925,7 @@ fn yanks_in_lockfiles_are_ok_http() { str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]], @@ -942,7 +942,7 @@ fn yanks_in_lockfiles_are_ok_git() { str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]], @@ -994,7 +994,7 @@ fn yanks_in_lockfiles_are_ok_for_other_update_http() { str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]], @@ -1017,7 +1017,7 @@ fn yanks_in_lockfiles_are_ok_for_other_update_git() { str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]], @@ -3226,7 +3226,7 @@ fn unknown_index_version_error() { .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.1.0 ([ROOT]/foo)` "#]]) @@ -3769,7 +3769,7 @@ foo v0.1.0 ([ROOT]/foo) .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.1.0 ([ROOT]/foo)` "#]]) @@ -3863,7 +3863,7 @@ fn not_found_permutations() { .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `a-b_c` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.0.1 ([ROOT]/foo)` "#]]) diff --git a/tests/testsuite/update.rs b/tests/testsuite/update.rs index 90525920692..87c36293dc2 100644 --- a/tests/testsuite/update.rs +++ b/tests/testsuite/update.rs @@ -456,7 +456,7 @@ perhaps a crate was updated and forgotten to be re-vendored? .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `serde` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `bar v0.0.1 ([ROOT]/foo)` "#]]) @@ -997,7 +997,7 @@ Caused by: .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.1.0 ([ROOT]/foo)` "#]]) @@ -1017,7 +1017,7 @@ required by package `foo v0.1.0 ([ROOT]/foo)` .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `bar` found -location searched: registry `crates-io` +location searched: `dummy-registry` index (which is replacing registry `crates-io`) required by package `foo v0.1.0 ([ROOT]/foo)` "#]])