From ad9a44ddde34d569bd76170b814ee0b96a24a71e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 25 May 2023 13:43:16 -0500 Subject: [PATCH] refactor(tests): Reduce cargo-remove setup load Benefits - Clarifies a tests needs - Speeds up testing, especially on Windows - Reduces disk space issues within CI --- .../cargo_remove/avoid_empty_tables/mod.rs | 16 ++++- tests/testsuite/cargo_remove/build/mod.rs | 16 ++++- tests/testsuite/cargo_remove/dev/mod.rs | 16 ++++- tests/testsuite/cargo_remove/dry_run/mod.rs | 16 ++++- tests/testsuite/cargo_remove/gc_patch/mod.rs | 4 +- .../testsuite/cargo_remove/gc_profile/mod.rs | 17 +++++- .../testsuite/cargo_remove/gc_replace/mod.rs | 17 +++++- .../testsuite/cargo_remove/invalid_arg/mod.rs | 16 ++++- .../testsuite/cargo_remove/invalid_dep/mod.rs | 16 ++++- .../cargo_remove/invalid_package/mod.rs | 18 +++++- .../invalid_package_multiple/mod.rs | 18 +++++- .../cargo_remove/invalid_section/mod.rs | 16 ++++- .../cargo_remove/invalid_section_dep/mod.rs | 16 ++++- .../cargo_remove/invalid_target/mod.rs | 18 +++++- .../cargo_remove/invalid_target_dep/mod.rs | 18 +++++- tests/testsuite/cargo_remove/mod.rs | 58 ------------------- .../cargo_remove/multiple_deps/mod.rs | 16 ++++- .../cargo_remove/multiple_dev/mod.rs | 16 ++++- tests/testsuite/cargo_remove/no_arg/mod.rs | 16 ++++- tests/testsuite/cargo_remove/offline/mod.rs | 16 ++++- .../cargo_remove/optional_dep_feature/mod.rs | 16 ++++- .../cargo_remove/optional_feature/mod.rs | 16 ++++- tests/testsuite/cargo_remove/package/mod.rs | 18 +++++- .../cargo_remove/remove_basic/mod.rs | 16 ++++- tests/testsuite/cargo_remove/target/mod.rs | 18 +++++- .../cargo_remove/target_build/mod.rs | 18 +++++- .../testsuite/cargo_remove/target_dev/mod.rs | 18 +++++- .../cargo_remove/update_lock_file/mod.rs | 16 ++++- tests/testsuite/cargo_remove/workspace/mod.rs | 16 ++++- .../cargo_remove/workspace_non_virtual/mod.rs | 16 ++++- .../cargo_remove/workspace_preserved/mod.rs | 16 ++++- 31 files changed, 396 insertions(+), 148 deletions(-) diff --git a/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs b/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs index 59a2333d6f7..17bc3f949e1 100644 --- a/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs +++ b/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/build/mod.rs b/tests/testsuite/cargo_remove/build/mod.rs index f4c9dcb94de..72ce478b904 100644 --- a/tests/testsuite/cargo_remove/build/mod.rs +++ b/tests/testsuite/cargo_remove/build/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/dev/mod.rs b/tests/testsuite/cargo_remove/dev/mod.rs index 7d61fa95405..d9cbdf1a7e0 100644 --- a/tests/testsuite/cargo_remove/dev/mod.rs +++ b/tests/testsuite/cargo_remove/dev/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/dry_run/mod.rs b/tests/testsuite/cargo_remove/dry_run/mod.rs index dca18931550..2e097135def 100644 --- a/tests/testsuite/cargo_remove/dry_run/mod.rs +++ b/tests/testsuite/cargo_remove/dry_run/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/gc_patch/mod.rs b/tests/testsuite/cargo_remove/gc_patch/mod.rs index 2c1d592fb33..ec521a5bb6c 100644 --- a/tests/testsuite/cargo_remove/gc_patch/mod.rs +++ b/tests/testsuite/cargo_remove/gc_patch/mod.rs @@ -5,11 +5,9 @@ use cargo_test_support::git; use cargo_test_support::project; use cargo_test_support::CargoCommand; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); let git_project1 = git::new("bar1", |project| { project diff --git a/tests/testsuite/cargo_remove/gc_profile/mod.rs b/tests/testsuite/cargo_remove/gc_profile/mod.rs index 7047c92e2f3..98b99bec34c 100644 --- a/tests/testsuite/cargo_remove/gc_profile/mod.rs +++ b/tests/testsuite/cargo_remove/gc_profile/mod.rs @@ -3,11 +3,22 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.2.3+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/gc_replace/mod.rs b/tests/testsuite/cargo_remove/gc_replace/mod.rs index 717adef3e56..cbcf5bc07a3 100644 --- a/tests/testsuite/cargo_remove/gc_replace/mod.rs +++ b/tests/testsuite/cargo_remove/gc_replace/mod.rs @@ -3,11 +3,22 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.2.3+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/invalid_arg/mod.rs b/tests/testsuite/cargo_remove/invalid_arg/mod.rs index eac3c8b4643..97d5c8625cd 100644 --- a/tests/testsuite/cargo_remove/invalid_arg/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_arg/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/invalid_dep/mod.rs b/tests/testsuite/cargo_remove/invalid_dep/mod.rs index c4dbeae910a..fb32a075f14 100644 --- a/tests/testsuite/cargo_remove/invalid_dep/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_dep/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/invalid_package/mod.rs b/tests/testsuite/cargo_remove/invalid_package/mod.rs index bff09882ed9..d7f84c035eb 100644 --- a/tests/testsuite/cargo_remove/invalid_package/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_package/mod.rs @@ -3,11 +3,23 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs b/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs index 5093d5d2dc7..d14179e0cc4 100644 --- a/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs @@ -3,11 +3,23 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/invalid_section/mod.rs b/tests/testsuite/cargo_remove/invalid_section/mod.rs index 80d42be1d6a..94d4750590d 100644 --- a/tests/testsuite/cargo_remove/invalid_section/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_section/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs b/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs index 7be8fd6284a..c20cd94d2ff 100644 --- a/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/invalid_target/mod.rs b/tests/testsuite/cargo_remove/invalid_target/mod.rs index 34deb6cb848..aba040a2b00 100644 --- a/tests/testsuite/cargo_remove/invalid_target/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_target/mod.rs @@ -3,11 +3,23 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs b/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs index e04418fa859..f187e609c33 100644 --- a/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs +++ b/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs @@ -3,11 +3,23 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/mod.rs b/tests/testsuite/cargo_remove/mod.rs index fd8b4a23319..feb08cea4b3 100644 --- a/tests/testsuite/cargo_remove/mod.rs +++ b/tests/testsuite/cargo_remove/mod.rs @@ -28,61 +28,3 @@ mod update_lock_file; mod workspace; mod workspace_non_virtual; mod workspace_preserved; - -fn init_registry() { - cargo_test_support::registry::init(); - add_registry_packages(false); -} - -fn add_registry_packages(alt: bool) { - for name in [ - "clippy", - "dbus", - "docopt", - "ncurses", - "pad", - "regex", - "rustc-serialize", - "toml", - ] { - cargo_test_support::registry::Package::new(name, "0.1.1+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "0.2.0+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "0.2.3+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "0.4.1+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "0.6.2+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "0.9.9+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "1.0.90+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "20.0.0+my-package") - .alternative(alt) - .publish(); - } - - for name in ["semver", "serde"] { - cargo_test_support::registry::Package::new(name, "0.1.1") - .alternative(alt) - .feature("std", &[]) - .publish(); - cargo_test_support::registry::Package::new(name, "0.9.0") - .alternative(alt) - .feature("std", &[]) - .publish(); - cargo_test_support::registry::Package::new(name, "1.0.90") - .alternative(alt) - .feature("std", &[]) - .publish(); - } -} diff --git a/tests/testsuite/cargo_remove/multiple_deps/mod.rs b/tests/testsuite/cargo_remove/multiple_deps/mod.rs index 35922b73894..d0af30a3016 100644 --- a/tests/testsuite/cargo_remove/multiple_deps/mod.rs +++ b/tests/testsuite/cargo_remove/multiple_deps/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/multiple_dev/mod.rs b/tests/testsuite/cargo_remove/multiple_dev/mod.rs index 5eac7e2f8f5..7ec2bd0b77b 100644 --- a/tests/testsuite/cargo_remove/multiple_dev/mod.rs +++ b/tests/testsuite/cargo_remove/multiple_dev/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/no_arg/mod.rs b/tests/testsuite/cargo_remove/no_arg/mod.rs index d0c66f9b05a..f9e0e554824 100644 --- a/tests/testsuite/cargo_remove/no_arg/mod.rs +++ b/tests/testsuite/cargo_remove/no_arg/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/offline/mod.rs b/tests/testsuite/cargo_remove/offline/mod.rs index d0346392731..e227eb0956c 100644 --- a/tests/testsuite/cargo_remove/offline/mod.rs +++ b/tests/testsuite/cargo_remove/offline/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs b/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs index cae736b347d..ce8fcf71227 100644 --- a/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs +++ b/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/optional_feature/mod.rs b/tests/testsuite/cargo_remove/optional_feature/mod.rs index af54226bba5..9ab3c4c24a1 100644 --- a/tests/testsuite/cargo_remove/optional_feature/mod.rs +++ b/tests/testsuite/cargo_remove/optional_feature/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/package/mod.rs b/tests/testsuite/cargo_remove/package/mod.rs index 2714f319725..73d01b89dba 100644 --- a/tests/testsuite/cargo_remove/package/mod.rs +++ b/tests/testsuite/cargo_remove/package/mod.rs @@ -3,11 +3,23 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/remove_basic/mod.rs b/tests/testsuite/cargo_remove/remove_basic/mod.rs index 53381e6bc99..7c92026a5e6 100644 --- a/tests/testsuite/cargo_remove/remove_basic/mod.rs +++ b/tests/testsuite/cargo_remove/remove_basic/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/target/mod.rs b/tests/testsuite/cargo_remove/target/mod.rs index 1447c753d3c..6f6fc5c6116 100644 --- a/tests/testsuite/cargo_remove/target/mod.rs +++ b/tests/testsuite/cargo_remove/target/mod.rs @@ -3,11 +3,23 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/target_build/mod.rs b/tests/testsuite/cargo_remove/target_build/mod.rs index 11afbbf8f8d..7adffa22922 100644 --- a/tests/testsuite/cargo_remove/target_build/mod.rs +++ b/tests/testsuite/cargo_remove/target_build/mod.rs @@ -3,11 +3,23 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/target_dev/mod.rs b/tests/testsuite/cargo_remove/target_dev/mod.rs index d303c2b857f..005eb78716b 100644 --- a/tests/testsuite/cargo_remove/target_dev/mod.rs +++ b/tests/testsuite/cargo_remove/target_dev/mod.rs @@ -3,11 +3,23 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/update_lock_file/mod.rs b/tests/testsuite/cargo_remove/update_lock_file/mod.rs index be5bc87f581..00e7964e45c 100644 --- a/tests/testsuite/cargo_remove/update_lock_file/mod.rs +++ b/tests/testsuite/cargo_remove/update_lock_file/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.1+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/workspace/mod.rs b/tests/testsuite/cargo_remove/workspace/mod.rs index 225fbec00e8..5274b07d7a1 100644 --- a/tests/testsuite/cargo_remove/workspace/mod.rs +++ b/tests/testsuite/cargo_remove/workspace/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/workspace_non_virtual/mod.rs b/tests/testsuite/cargo_remove/workspace_non_virtual/mod.rs index 225fbec00e8..5274b07d7a1 100644 --- a/tests/testsuite/cargo_remove/workspace_non_virtual/mod.rs +++ b/tests/testsuite/cargo_remove/workspace_non_virtual/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root; diff --git a/tests/testsuite/cargo_remove/workspace_preserved/mod.rs b/tests/testsuite/cargo_remove/workspace_preserved/mod.rs index 225fbec00e8..5274b07d7a1 100644 --- a/tests/testsuite/cargo_remove/workspace_preserved/mod.rs +++ b/tests/testsuite/cargo_remove/workspace_preserved/mod.rs @@ -3,11 +3,21 @@ use cargo_test_support::curr_dir; use cargo_test_support::CargoCommand; use cargo_test_support::Project; -use crate::cargo_remove::init_registry; - #[cargo_test] fn case() { - init_registry(); + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish(); + cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish(); + cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish(); + cargo_test_support::registry::Package::new("semver", "0.1.1") + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new("serde", "1.0.90") + .feature("std", &[]) + .publish(); + let project = Project::from_template(curr_dir!().join("in")); let project_root = project.root(); let cwd = &project_root;