diff --git a/tests/testsuite/cargo_add.rs b/tests/testsuite/cargo_add.rs index 5e5a3a564e5..e5fc379626c 100644 --- a/tests/testsuite/cargo_add.rs +++ b/tests/testsuite/cargo_add.rs @@ -2,6 +2,8 @@ use cargo_test_support::compare::assert; use cargo_test_support::prelude::*; use cargo_test_support::Project; +mod build_prefer_existing_version; + fn init_registry() { cargo_test_support::registry::init(); add_registry_packages(false); @@ -202,28 +204,6 @@ fn build() { assert().subset_matches("tests/snapshots/add/build/out", &project_root); } -#[cargo_test] -fn build_prefer_existing_version() { - init_alt_registry(); - let project = Project::from_template("tests/snapshots/add/build_prefer_existing_version/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency --build") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/build_prefer_existing_version/stdout.log") - .stderr_matches_path("tests/snapshots/add/build_prefer_existing_version/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/build_prefer_existing_version/out", - &project_root, - ); -} - #[cargo_test] fn default_features() { init_registry(); diff --git a/tests/snapshots/add/build_prefer_existing_version/in/Cargo.toml b/tests/testsuite/cargo_add/build_prefer_existing_version/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/build_prefer_existing_version/in/Cargo.toml rename to tests/testsuite/cargo_add/build_prefer_existing_version/in/Cargo.toml diff --git a/tests/snapshots/add/build_prefer_existing_version/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/build_prefer_existing_version/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/build_prefer_existing_version/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/build_prefer_existing_version/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/build_prefer_existing_version/in/src/lib.rs b/tests/testsuite/cargo_add/build_prefer_existing_version/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/build_prefer_existing_version/in/src/lib.rs rename to tests/testsuite/cargo_add/build_prefer_existing_version/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/build_prefer_existing_version/mod.rs b/tests/testsuite/cargo_add/build_prefer_existing_version/mod.rs new file mode 100644 index 00000000000..594ab58bad5 --- /dev/null +++ b/tests/testsuite/cargo_add/build_prefer_existing_version/mod.rs @@ -0,0 +1,28 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_alt_registry; + +#[cargo_test] +fn build_prefer_existing_version() { + init_alt_registry(); + let project = + Project::from_template("tests/testsuite/cargo_add/build_prefer_existing_version/in"); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency --build") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path("tests/testsuite/cargo_add/build_prefer_existing_version/stdout.log") + .stderr_matches_path("tests/testsuite/cargo_add/build_prefer_existing_version/stderr.log"); + + assert().subset_matches( + "tests/testsuite/cargo_add/build_prefer_existing_version/out", + &project_root, + ); +} diff --git a/tests/snapshots/add/build_prefer_existing_version/out/Cargo.toml b/tests/testsuite/cargo_add/build_prefer_existing_version/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/build_prefer_existing_version/out/Cargo.toml rename to tests/testsuite/cargo_add/build_prefer_existing_version/out/Cargo.toml diff --git a/tests/snapshots/add/build_prefer_existing_version/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/build_prefer_existing_version/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/build_prefer_existing_version/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/build_prefer_existing_version/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/build_prefer_existing_version/stderr.log b/tests/testsuite/cargo_add/build_prefer_existing_version/stderr.log similarity index 100% rename from tests/snapshots/add/build_prefer_existing_version/stderr.log rename to tests/testsuite/cargo_add/build_prefer_existing_version/stderr.log diff --git a/tests/snapshots/add/build_prefer_existing_version/stdout.log b/tests/testsuite/cargo_add/build_prefer_existing_version/stdout.log similarity index 100% rename from tests/snapshots/add/build_prefer_existing_version/stdout.log rename to tests/testsuite/cargo_add/build_prefer_existing_version/stdout.log