Skip to content
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
24 changes: 2 additions & 22 deletions tests/testsuite/cargo_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
28 changes: 28 additions & 0 deletions tests/testsuite/cargo_add/build_prefer_existing_version/mod.rs
Original file line number Diff line number Diff line change
@@ -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,
);
}