Skip to content

Commit

Permalink
test: update message snapshots to align with new error message
Browse files Browse the repository at this point in the history
  • Loading branch information
chentodd committed Oct 22, 2024
1 parent 35a595f commit e673802
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 41 deletions.
2 changes: 1 addition & 1 deletion tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
"#]])
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
"#]])
Expand Down Expand Up @@ -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)`
"#]])
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/local_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
"#]])
Expand Down
29 changes: 19 additions & 10 deletions tests/testsuite/offline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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",
Expand All @@ -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]
Expand Down Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions tests/testsuite/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
"#]])
Expand Down Expand Up @@ -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)`
"#]])
Expand All @@ -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)`
"#]])
Expand Down Expand Up @@ -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)`
"#]])
Expand Down Expand Up @@ -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)`
"#]])
Expand Down Expand Up @@ -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)`
"#]])
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
"#]])
Expand Down
34 changes: 17 additions & 17 deletions tests/testsuite/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
"#]]);
Expand All @@ -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)`
"#]]);
Expand Down Expand Up @@ -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)`
"#]]);
Expand All @@ -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)`
"#]]);
Expand Down Expand Up @@ -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)`
"#]]);
Expand All @@ -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)`
"#]]);
Expand Down Expand Up @@ -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)`
"#]],
Expand All @@ -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)`
"#]],
Expand Down Expand Up @@ -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)`
"#]],
Expand Down Expand Up @@ -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)`
"#]],
Expand Down Expand Up @@ -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)`
"#]],
Expand All @@ -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)`
"#]],
Expand Down Expand Up @@ -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)`
"#]],
Expand All @@ -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)`
"#]],
Expand Down Expand Up @@ -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)`
"#]])
Expand Down Expand Up @@ -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)`
"#]])
Expand Down Expand Up @@ -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)`
"#]])
Expand Down
6 changes: 3 additions & 3 deletions tests/testsuite/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
"#]])
Expand Down Expand Up @@ -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)`
"#]])
Expand All @@ -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)`
"#]])
Expand Down

0 comments on commit e673802

Please sign in to comment.