From 9bdc7779519dac000a8a0cb6d78a87ec15663789 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 5 Dec 2024 09:15:17 -0600 Subject: [PATCH 1/4] test(add): Make name normalization test names consistent --- tests/testsuite/cargo_add/mod.rs | 12 ++++++------ .../in | 0 .../mod.rs | 0 .../out/Cargo.toml | 0 .../stderr.term.svg | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency}/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../mod.rs | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../stderr.term.svg | 0 .../in/Cargo.lock | 0 .../in/Cargo.toml | 0 .../in/fuzzy_name/Cargo.toml | 0 .../in/fuzzy_name}/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../mod.rs | 0 .../out/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../out/primary/src/lib.rs | 0 .../stderr.term.svg | 0 .../in | 0 .../mod.rs | 0 .../out/Cargo.toml | 0 .../stderr.term.svg | 0 .../in/Cargo.toml | 0 .../in/src/lib.rs | 0 .../mod.rs | 0 .../out/Cargo.toml | 0 .../stderr.term.svg | 0 .../in/Cargo.toml | 0 .../in/primary/Cargo.toml | 0 .../in/primary}/src/lib.rs | 0 .../mod.rs | 0 .../out/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../out}/primary/src/lib.rs | 0 .../stderr.term.svg | 0 41 files changed, 6 insertions(+), 6 deletions(-) rename tests/testsuite/cargo_add/{add_normalized_name_external => normalize_name_git}/in (100%) rename tests/testsuite/cargo_add/{git_normalized_name => normalize_name_git}/mod.rs (100%) rename tests/testsuite/cargo_add/{git_normalized_name => normalize_name_git}/out/Cargo.toml (100%) rename tests/testsuite/cargo_add/{git_normalized_name => normalize_name_git}/stderr.term.svg (100%) rename tests/testsuite/cargo_add/{path_normalized_name => normalize_name_path}/in/dependency/Cargo.toml (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy/in/fuzzy_name => normalize_name_path/in/dependency}/src/lib.rs (100%) rename tests/testsuite/cargo_add/{path_normalized_name => normalize_name_path}/in/primary/Cargo.toml (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy => normalize_name_path}/in/primary/src/lib.rs (100%) rename tests/testsuite/cargo_add/{path_normalized_name => normalize_name_path}/mod.rs (100%) rename tests/testsuite/cargo_add/{path_normalized_name => normalize_name_path}/out/dependency/Cargo.toml (100%) rename tests/testsuite/cargo_add/{path_normalized_name => normalize_name_path}/out/primary/Cargo.toml (100%) rename tests/testsuite/cargo_add/{path_normalized_name => normalize_name_path}/stderr.term.svg (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy => normalize_name_path_existing}/in/Cargo.lock (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy => normalize_name_path_existing}/in/Cargo.toml (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy => normalize_name_path_existing}/in/fuzzy_name/Cargo.toml (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy/out/primary => normalize_name_path_existing/in/fuzzy_name}/src/lib.rs (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy => normalize_name_path_existing}/in/primary/Cargo.toml (100%) rename tests/testsuite/cargo_add/{detect_workspace_inherit_fuzzy => normalize_name_path_existing}/in/primary/src/lib.rs (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy => normalize_name_path_existing}/mod.rs (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy => normalize_name_path_existing}/out/Cargo.toml (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy => normalize_name_path_existing}/out/primary/Cargo.toml (100%) rename tests/testsuite/cargo_add/{detect_workspace_inherit_fuzzy => normalize_name_path_existing}/out/primary/src/lib.rs (100%) rename tests/testsuite/cargo_add/{add_workspace_non_fuzzy => normalize_name_path_existing}/stderr.term.svg (100%) rename tests/testsuite/cargo_add/{git_normalized_name => normalize_name_registry}/in (100%) rename tests/testsuite/cargo_add/{add_normalized_name_external => normalize_name_registry}/mod.rs (100%) rename tests/testsuite/cargo_add/{add_normalized_name_external => normalize_name_registry}/out/Cargo.toml (100%) rename tests/testsuite/cargo_add/{add_normalized_name_external => normalize_name_registry}/stderr.term.svg (100%) rename tests/testsuite/cargo_add/{features_fuzzy => normalize_name_registry_existing}/in/Cargo.toml (100%) rename tests/testsuite/cargo_add/{features_fuzzy => normalize_name_registry_existing}/in/src/lib.rs (100%) rename tests/testsuite/cargo_add/{features_fuzzy => normalize_name_registry_existing}/mod.rs (100%) rename tests/testsuite/cargo_add/{features_fuzzy => normalize_name_registry_existing}/out/Cargo.toml (100%) rename tests/testsuite/cargo_add/{features_fuzzy => normalize_name_registry_existing}/stderr.term.svg (100%) rename tests/testsuite/cargo_add/{detect_workspace_inherit_fuzzy => normalize_name_workspace_dep}/in/Cargo.toml (100%) rename tests/testsuite/cargo_add/{detect_workspace_inherit_fuzzy => normalize_name_workspace_dep}/in/primary/Cargo.toml (100%) rename tests/testsuite/cargo_add/{path_normalized_name/in/dependency => normalize_name_workspace_dep/in/primary}/src/lib.rs (100%) rename tests/testsuite/cargo_add/{detect_workspace_inherit_fuzzy => normalize_name_workspace_dep}/mod.rs (100%) rename tests/testsuite/cargo_add/{detect_workspace_inherit_fuzzy => normalize_name_workspace_dep}/out/Cargo.toml (100%) rename tests/testsuite/cargo_add/{detect_workspace_inherit_fuzzy => normalize_name_workspace_dep}/out/primary/Cargo.toml (100%) rename tests/testsuite/cargo_add/{path_normalized_name/in => normalize_name_workspace_dep/out}/primary/src/lib.rs (100%) rename tests/testsuite/cargo_add/{detect_workspace_inherit_fuzzy => normalize_name_workspace_dep}/stderr.term.svg (100%) diff --git a/tests/testsuite/cargo_add/mod.rs b/tests/testsuite/cargo_add/mod.rs index ec00ba48c8a..90bd1881eba 100644 --- a/tests/testsuite/cargo_add/mod.rs +++ b/tests/testsuite/cargo_add/mod.rs @@ -2,9 +2,7 @@ mod add_basic; mod add_multiple; mod add_no_vendored_package_with_alter_registry; mod add_no_vendored_package_with_vendor; -mod add_normalized_name_external; mod add_toolchain; -mod add_workspace_non_fuzzy; mod build; mod build_prefer_existing_version; mod change_rename_target; @@ -14,7 +12,6 @@ mod deprecated_default_features; mod deprecated_section; mod detect_workspace_inherit; mod detect_workspace_inherit_features; -mod detect_workspace_inherit_fuzzy; mod detect_workspace_inherit_optional; mod detect_workspace_inherit_path_base; mod detect_workspace_inherit_public; @@ -28,7 +25,6 @@ mod features; mod features_activated_over_limit; mod features_deactivated_over_limit; mod features_empty; -mod features_fuzzy; mod features_multiple_occurrences; mod features_preserve; mod features_spaced_values; @@ -42,7 +38,6 @@ mod git_inferred_name; mod git_inferred_name_multiple; mod git_multiple_names; mod git_multiple_packages_features; -mod git_normalized_name; mod git_registry; mod git_rev; mod git_tag; @@ -75,6 +70,12 @@ mod no_args; mod no_default_features; mod no_optional; mod no_public; +mod normalize_name_git; +mod normalize_name_path; +mod normalize_name_path_existing; +mod normalize_name_registry; +mod normalize_name_registry_existing; +mod normalize_name_workspace_dep; mod offline_empty_cache; mod optional; mod overwrite_default_features; @@ -118,7 +119,6 @@ mod path_base_unstable; mod path_dev; mod path_inferred_name; mod path_inferred_name_conflicts_full_feature; -mod path_normalized_name; mod preserve_dep_std_table; mod preserve_features_sorted; mod preserve_features_table; diff --git a/tests/testsuite/cargo_add/add_normalized_name_external/in b/tests/testsuite/cargo_add/normalize_name_git/in similarity index 100% rename from tests/testsuite/cargo_add/add_normalized_name_external/in rename to tests/testsuite/cargo_add/normalize_name_git/in diff --git a/tests/testsuite/cargo_add/git_normalized_name/mod.rs b/tests/testsuite/cargo_add/normalize_name_git/mod.rs similarity index 100% rename from tests/testsuite/cargo_add/git_normalized_name/mod.rs rename to tests/testsuite/cargo_add/normalize_name_git/mod.rs diff --git a/tests/testsuite/cargo_add/git_normalized_name/out/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_git/out/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/git_normalized_name/out/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_git/out/Cargo.toml diff --git a/tests/testsuite/cargo_add/git_normalized_name/stderr.term.svg b/tests/testsuite/cargo_add/normalize_name_git/stderr.term.svg similarity index 100% rename from tests/testsuite/cargo_add/git_normalized_name/stderr.term.svg rename to tests/testsuite/cargo_add/normalize_name_git/stderr.term.svg diff --git a/tests/testsuite/cargo_add/path_normalized_name/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_path/in/dependency/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/path_normalized_name/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_path/in/dependency/Cargo.toml diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/fuzzy_name/src/lib.rs b/tests/testsuite/cargo_add/normalize_name_path/in/dependency/src/lib.rs similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/fuzzy_name/src/lib.rs rename to tests/testsuite/cargo_add/normalize_name_path/in/dependency/src/lib.rs diff --git a/tests/testsuite/cargo_add/path_normalized_name/in/primary/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_path/in/primary/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/path_normalized_name/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_path/in/primary/Cargo.toml diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/primary/src/lib.rs b/tests/testsuite/cargo_add/normalize_name_path/in/primary/src/lib.rs similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/normalize_name_path/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/path_normalized_name/mod.rs b/tests/testsuite/cargo_add/normalize_name_path/mod.rs similarity index 100% rename from tests/testsuite/cargo_add/path_normalized_name/mod.rs rename to tests/testsuite/cargo_add/normalize_name_path/mod.rs diff --git a/tests/testsuite/cargo_add/path_normalized_name/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_path/out/dependency/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/path_normalized_name/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_path/out/dependency/Cargo.toml diff --git a/tests/testsuite/cargo_add/path_normalized_name/out/primary/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_path/out/primary/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/path_normalized_name/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_path/out/primary/Cargo.toml diff --git a/tests/testsuite/cargo_add/path_normalized_name/stderr.term.svg b/tests/testsuite/cargo_add/normalize_name_path/stderr.term.svg similarity index 100% rename from tests/testsuite/cargo_add/path_normalized_name/stderr.term.svg rename to tests/testsuite/cargo_add/normalize_name_path/stderr.term.svg diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/Cargo.lock b/tests/testsuite/cargo_add/normalize_name_path_existing/in/Cargo.lock similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/Cargo.lock rename to tests/testsuite/cargo_add/normalize_name_path_existing/in/Cargo.lock diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_path_existing/in/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_path_existing/in/Cargo.toml diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/fuzzy_name/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_path_existing/in/fuzzy_name/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/fuzzy_name/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_path_existing/in/fuzzy_name/Cargo.toml diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/out/primary/src/lib.rs b/tests/testsuite/cargo_add/normalize_name_path_existing/in/fuzzy_name/src/lib.rs similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/out/primary/src/lib.rs rename to tests/testsuite/cargo_add/normalize_name_path_existing/in/fuzzy_name/src/lib.rs diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/primary/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_path_existing/in/primary/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_path_existing/in/primary/Cargo.toml diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/in/primary/src/lib.rs b/tests/testsuite/cargo_add/normalize_name_path_existing/in/primary/src/lib.rs similarity index 100% rename from tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/normalize_name_path_existing/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/mod.rs b/tests/testsuite/cargo_add/normalize_name_path_existing/mod.rs similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/mod.rs rename to tests/testsuite/cargo_add/normalize_name_path_existing/mod.rs diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/out/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_path_existing/out/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/out/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_path_existing/out/Cargo.toml diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/out/primary/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_path_existing/out/primary/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_path_existing/out/primary/Cargo.toml diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/out/primary/src/lib.rs b/tests/testsuite/cargo_add/normalize_name_path_existing/out/primary/src/lib.rs similarity index 100% rename from tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/out/primary/src/lib.rs rename to tests/testsuite/cargo_add/normalize_name_path_existing/out/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/add_workspace_non_fuzzy/stderr.term.svg b/tests/testsuite/cargo_add/normalize_name_path_existing/stderr.term.svg similarity index 100% rename from tests/testsuite/cargo_add/add_workspace_non_fuzzy/stderr.term.svg rename to tests/testsuite/cargo_add/normalize_name_path_existing/stderr.term.svg diff --git a/tests/testsuite/cargo_add/git_normalized_name/in b/tests/testsuite/cargo_add/normalize_name_registry/in similarity index 100% rename from tests/testsuite/cargo_add/git_normalized_name/in rename to tests/testsuite/cargo_add/normalize_name_registry/in diff --git a/tests/testsuite/cargo_add/add_normalized_name_external/mod.rs b/tests/testsuite/cargo_add/normalize_name_registry/mod.rs similarity index 100% rename from tests/testsuite/cargo_add/add_normalized_name_external/mod.rs rename to tests/testsuite/cargo_add/normalize_name_registry/mod.rs diff --git a/tests/testsuite/cargo_add/add_normalized_name_external/out/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_registry/out/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/add_normalized_name_external/out/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_registry/out/Cargo.toml diff --git a/tests/testsuite/cargo_add/add_normalized_name_external/stderr.term.svg b/tests/testsuite/cargo_add/normalize_name_registry/stderr.term.svg similarity index 100% rename from tests/testsuite/cargo_add/add_normalized_name_external/stderr.term.svg rename to tests/testsuite/cargo_add/normalize_name_registry/stderr.term.svg diff --git a/tests/testsuite/cargo_add/features_fuzzy/in/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_registry_existing/in/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/features_fuzzy/in/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_registry_existing/in/Cargo.toml diff --git a/tests/testsuite/cargo_add/features_fuzzy/in/src/lib.rs b/tests/testsuite/cargo_add/normalize_name_registry_existing/in/src/lib.rs similarity index 100% rename from tests/testsuite/cargo_add/features_fuzzy/in/src/lib.rs rename to tests/testsuite/cargo_add/normalize_name_registry_existing/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/features_fuzzy/mod.rs b/tests/testsuite/cargo_add/normalize_name_registry_existing/mod.rs similarity index 100% rename from tests/testsuite/cargo_add/features_fuzzy/mod.rs rename to tests/testsuite/cargo_add/normalize_name_registry_existing/mod.rs diff --git a/tests/testsuite/cargo_add/features_fuzzy/out/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_registry_existing/out/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/features_fuzzy/out/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_registry_existing/out/Cargo.toml diff --git a/tests/testsuite/cargo_add/features_fuzzy/stderr.term.svg b/tests/testsuite/cargo_add/normalize_name_registry_existing/stderr.term.svg similarity index 100% rename from tests/testsuite/cargo_add/features_fuzzy/stderr.term.svg rename to tests/testsuite/cargo_add/normalize_name_registry_existing/stderr.term.svg diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/in/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_workspace_dep/in/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/in/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_workspace_dep/in/Cargo.toml diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/in/primary/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_workspace_dep/in/primary/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_workspace_dep/in/primary/Cargo.toml diff --git a/tests/testsuite/cargo_add/path_normalized_name/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/normalize_name_workspace_dep/in/primary/src/lib.rs similarity index 100% rename from tests/testsuite/cargo_add/path_normalized_name/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/normalize_name_workspace_dep/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/mod.rs b/tests/testsuite/cargo_add/normalize_name_workspace_dep/mod.rs similarity index 100% rename from tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/mod.rs rename to tests/testsuite/cargo_add/normalize_name_workspace_dep/mod.rs diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/out/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_workspace_dep/out/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/out/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_workspace_dep/out/Cargo.toml diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/out/primary/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_workspace_dep/out/primary/Cargo.toml similarity index 100% rename from tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/normalize_name_workspace_dep/out/primary/Cargo.toml diff --git a/tests/testsuite/cargo_add/path_normalized_name/in/primary/src/lib.rs b/tests/testsuite/cargo_add/normalize_name_workspace_dep/out/primary/src/lib.rs similarity index 100% rename from tests/testsuite/cargo_add/path_normalized_name/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/normalize_name_workspace_dep/out/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/stderr.term.svg b/tests/testsuite/cargo_add/normalize_name_workspace_dep/stderr.term.svg similarity index 100% rename from tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/stderr.term.svg rename to tests/testsuite/cargo_add/normalize_name_workspace_dep/stderr.term.svg From e008a39f471896e669a10d870088a0d042e00715 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 5 Dec 2024 09:21:24 -0600 Subject: [PATCH 2/4] test(add): Check normalization with a yanked package --- tests/testsuite/cargo_add/mod.rs | 1 + .../normalize_name_registry_yanked/in | 1 + .../normalize_name_registry_yanked/mod.rs | 31 +++++++++++++++++ .../out/Cargo.toml | 6 ++++ .../stderr.term.svg | 33 +++++++++++++++++++ 5 files changed, 72 insertions(+) create mode 120000 tests/testsuite/cargo_add/normalize_name_registry_yanked/in create mode 100644 tests/testsuite/cargo_add/normalize_name_registry_yanked/mod.rs create mode 100644 tests/testsuite/cargo_add/normalize_name_registry_yanked/out/Cargo.toml create mode 100644 tests/testsuite/cargo_add/normalize_name_registry_yanked/stderr.term.svg diff --git a/tests/testsuite/cargo_add/mod.rs b/tests/testsuite/cargo_add/mod.rs index 90bd1881eba..9e03c0bf639 100644 --- a/tests/testsuite/cargo_add/mod.rs +++ b/tests/testsuite/cargo_add/mod.rs @@ -75,6 +75,7 @@ mod normalize_name_path; mod normalize_name_path_existing; mod normalize_name_registry; mod normalize_name_registry_existing; +mod normalize_name_registry_yanked; mod normalize_name_workspace_dep; mod offline_empty_cache; mod optional; diff --git a/tests/testsuite/cargo_add/normalize_name_registry_yanked/in b/tests/testsuite/cargo_add/normalize_name_registry_yanked/in new file mode 120000 index 00000000000..6c6a27fcfb5 --- /dev/null +++ b/tests/testsuite/cargo_add/normalize_name_registry_yanked/in @@ -0,0 +1 @@ +../add-basic.in \ No newline at end of file diff --git a/tests/testsuite/cargo_add/normalize_name_registry_yanked/mod.rs b/tests/testsuite/cargo_add/normalize_name_registry_yanked/mod.rs new file mode 100644 index 00000000000..91950756ee3 --- /dev/null +++ b/tests/testsuite/cargo_add/normalize_name_registry_yanked/mod.rs @@ -0,0 +1,31 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::current_dir; +use cargo_test_support::file; +use cargo_test_support::prelude::*; +use cargo_test_support::str; +use cargo_test_support::Project; + +#[cargo_test] +fn case() { + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("linked-hash-map", "0.5.0").publish(); + cargo_test_support::registry::Package::new("linked-hash-map", "0.5.4").publish(); + cargo_test_support::registry::Package::new("linked-hash-map", "0.6.0") + .yanked(true) + .publish(); + + let project = Project::from_template(current_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("add") + .arg_line("linked_hash_map") + .current_dir(cwd) + .assert() + .failure() + .stdout_eq(str![""]) + .stderr_eq(file!["stderr.term.svg"]); + + assert_ui().subset_matches(current_dir!().join("out"), &project_root); +} diff --git a/tests/testsuite/cargo_add/normalize_name_registry_yanked/out/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_registry_yanked/out/Cargo.toml new file mode 100644 index 00000000000..946b7c86bf0 --- /dev/null +++ b/tests/testsuite/cargo_add/normalize_name_registry_yanked/out/Cargo.toml @@ -0,0 +1,6 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" +edition = "2015" diff --git a/tests/testsuite/cargo_add/normalize_name_registry_yanked/stderr.term.svg b/tests/testsuite/cargo_add/normalize_name_registry_yanked/stderr.term.svg new file mode 100644 index 00000000000..7970291d956 --- /dev/null +++ b/tests/testsuite/cargo_add/normalize_name_registry_yanked/stderr.term.svg @@ -0,0 +1,33 @@ + + + + + + + Updating `dummy-registry` index + + warning: translating `linked_hash_map` to `linked-hash-map` + + error: the crate `linked-hash-map@0.6.0` could not be found in registry index. + + + + + + From 737a5e8325b8886751fa2b2862b737a755897c8e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 5 Dec 2024 09:24:46 -0600 Subject: [PATCH 3/4] test(add): Verify yanked behavior --- tests/testsuite/cargo_add/mod.rs | 1 + tests/testsuite/cargo_add/yanked/in | 1 + tests/testsuite/cargo_add/yanked/mod.rs | 31 +++++++++++++++++++ .../testsuite/cargo_add/yanked/out/Cargo.toml | 9 ++++++ .../cargo_add/yanked/stderr.term.svg | 31 +++++++++++++++++++ 5 files changed, 73 insertions(+) create mode 120000 tests/testsuite/cargo_add/yanked/in create mode 100644 tests/testsuite/cargo_add/yanked/mod.rs create mode 100644 tests/testsuite/cargo_add/yanked/out/Cargo.toml create mode 100644 tests/testsuite/cargo_add/yanked/stderr.term.svg diff --git a/tests/testsuite/cargo_add/mod.rs b/tests/testsuite/cargo_add/mod.rs index 9e03c0bf639..35ab71346c6 100644 --- a/tests/testsuite/cargo_add/mod.rs +++ b/tests/testsuite/cargo_add/mod.rs @@ -150,3 +150,4 @@ mod vers; mod workspace_name; mod workspace_path; mod workspace_path_dev; +mod yanked; diff --git a/tests/testsuite/cargo_add/yanked/in b/tests/testsuite/cargo_add/yanked/in new file mode 120000 index 00000000000..6c6a27fcfb5 --- /dev/null +++ b/tests/testsuite/cargo_add/yanked/in @@ -0,0 +1 @@ +../add-basic.in \ No newline at end of file diff --git a/tests/testsuite/cargo_add/yanked/mod.rs b/tests/testsuite/cargo_add/yanked/mod.rs new file mode 100644 index 00000000000..050943fe897 --- /dev/null +++ b/tests/testsuite/cargo_add/yanked/mod.rs @@ -0,0 +1,31 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::current_dir; +use cargo_test_support::file; +use cargo_test_support::prelude::*; +use cargo_test_support::str; +use cargo_test_support::Project; + +#[cargo_test] +fn case() { + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("linked-hash-map", "0.5.0").publish(); + cargo_test_support::registry::Package::new("linked-hash-map", "0.5.4").publish(); + cargo_test_support::registry::Package::new("linked-hash-map", "0.6.0") + .yanked(true) + .publish(); + + let project = Project::from_template(current_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("add") + .arg_line("linked-hash-map") + .current_dir(cwd) + .assert() + .success() + .stdout_eq(str![""]) + .stderr_eq(file!["stderr.term.svg"]); + + assert_ui().subset_matches(current_dir!().join("out"), &project_root); +} diff --git a/tests/testsuite/cargo_add/yanked/out/Cargo.toml b/tests/testsuite/cargo_add/yanked/out/Cargo.toml new file mode 100644 index 00000000000..89e018f0e01 --- /dev/null +++ b/tests/testsuite/cargo_add/yanked/out/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" +edition = "2015" + +[dependencies] +linked-hash-map = "0.5.4" diff --git a/tests/testsuite/cargo_add/yanked/stderr.term.svg b/tests/testsuite/cargo_add/yanked/stderr.term.svg new file mode 100644 index 00000000000..cf47fc90e6d --- /dev/null +++ b/tests/testsuite/cargo_add/yanked/stderr.term.svg @@ -0,0 +1,31 @@ + + + + + + + Updating `dummy-registry` index + + Adding linked-hash-map v0.5.4 to dependencies + + Locking 1 package to latest compatible version + + + + + + From 5df493ecd9dc3fa138a5dfa3563a1982464d06c0 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 5 Dec 2024 09:48:21 -0600 Subject: [PATCH 4/4] fix(add): Don't select yanked versions when normalizing names Fixes #14893 --- src/cargo/sources/registry/mod.rs | 8 +++++++- .../cargo_add/normalize_name_registry_yanked/mod.rs | 2 +- .../normalize_name_registry_yanked/out/Cargo.toml | 3 +++ .../normalize_name_registry_yanked/stderr.term.svg | 9 +++++---- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/cargo/sources/registry/mod.rs b/src/cargo/sources/registry/mod.rs index 4a4c22b468e..ed36c31f331 100644 --- a/src/cargo/sources/registry/mod.rs +++ b/src/cargo/sources/registry/mod.rs @@ -856,7 +856,13 @@ impl<'gctx> Source for RegistrySource<'gctx> { } any_pending |= self .index - .query_inner(name_permutation, &req, &mut *self.ops, f)? + .query_inner(name_permutation, &req, &mut *self.ops, &mut |s| { + if !s.is_yanked() { + f(s); + } else if kind == QueryKind::Alternatives { + f(s); + } + })? .is_pending(); } } diff --git a/tests/testsuite/cargo_add/normalize_name_registry_yanked/mod.rs b/tests/testsuite/cargo_add/normalize_name_registry_yanked/mod.rs index 91950756ee3..4b3bedb34ea 100644 --- a/tests/testsuite/cargo_add/normalize_name_registry_yanked/mod.rs +++ b/tests/testsuite/cargo_add/normalize_name_registry_yanked/mod.rs @@ -23,7 +23,7 @@ fn case() { .arg_line("linked_hash_map") .current_dir(cwd) .assert() - .failure() + .success() .stdout_eq(str![""]) .stderr_eq(file!["stderr.term.svg"]); diff --git a/tests/testsuite/cargo_add/normalize_name_registry_yanked/out/Cargo.toml b/tests/testsuite/cargo_add/normalize_name_registry_yanked/out/Cargo.toml index 946b7c86bf0..89e018f0e01 100644 --- a/tests/testsuite/cargo_add/normalize_name_registry_yanked/out/Cargo.toml +++ b/tests/testsuite/cargo_add/normalize_name_registry_yanked/out/Cargo.toml @@ -4,3 +4,6 @@ name = "cargo-list-test-fixture" version = "0.0.0" edition = "2015" + +[dependencies] +linked-hash-map = "0.5.4" diff --git a/tests/testsuite/cargo_add/normalize_name_registry_yanked/stderr.term.svg b/tests/testsuite/cargo_add/normalize_name_registry_yanked/stderr.term.svg index 7970291d956..4766fc1a798 100644 --- a/tests/testsuite/cargo_add/normalize_name_registry_yanked/stderr.term.svg +++ b/tests/testsuite/cargo_add/normalize_name_registry_yanked/stderr.term.svg @@ -1,9 +1,8 @@ - +