Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(tests): Reduce cargo-remove setup load #12184

Merged
merged 1 commit into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 13 additions & 3 deletions tests/testsuite/cargo_remove/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 13 additions & 3 deletions tests/testsuite/cargo_remove/dev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 13 additions & 3 deletions tests/testsuite/cargo_remove/dry_run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions tests/testsuite/cargo_remove/gc_patch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions tests/testsuite/cargo_remove/gc_profile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 14 additions & 3 deletions tests/testsuite/cargo_remove/gc_replace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 13 additions & 3 deletions tests/testsuite/cargo_remove/invalid_arg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 13 additions & 3 deletions tests/testsuite/cargo_remove/invalid_dep/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 15 additions & 3 deletions tests/testsuite/cargo_remove/invalid_package/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 15 additions & 3 deletions tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 13 additions & 3 deletions tests/testsuite/cargo_remove/invalid_section/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 13 additions & 3 deletions tests/testsuite/cargo_remove/invalid_section_dep/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 15 additions & 3 deletions tests/testsuite/cargo_remove/invalid_target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 15 additions & 3 deletions tests/testsuite/cargo_remove/invalid_target_dep/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading