diff options
Diffstat (limited to 'src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version')
9 files changed, 71 insertions, 0 deletions
diff --git a/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/Cargo.toml new file mode 100644 index 000000000..6a6ac823f --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] +exclude = ["dependency"] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" + +[dependencies] +cargo-list-test-fixture-dependency = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["one", "two"], registry = "alternative" } diff --git a/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/Cargo.toml new file mode 100644 index 000000000..58b909cef --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture-dependency" +version = "0.0.0" + +[features] +one = [] +two = [] diff --git a/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/src/lib.rs new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/dependency/src/lib.rs diff --git a/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/src/lib.rs new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/in/src/lib.rs diff --git a/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/mod.rs b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/mod.rs new file mode 100644 index 000000000..b0bb2e03b --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/mod.rs @@ -0,0 +1,28 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_alt_registry; + +#[cargo_test] +fn case() { + 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_ui() + .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_ui().subset_matches( + "tests/testsuite/cargo_add/build_prefer_existing_version/out", + &project_root, + ); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/out/Cargo.toml new file mode 100644 index 000000000..123af6d22 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/out/Cargo.toml @@ -0,0 +1,12 @@ +[workspace] +exclude = ["dependency"] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" + +[dependencies] +cargo-list-test-fixture-dependency = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["one", "two"], registry = "alternative" } + +[build-dependencies] +cargo-list-test-fixture-dependency = { version = "0.0.0", path = "dependency", registry = "alternative" } diff --git a/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/out/dependency/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/out/dependency/Cargo.toml new file mode 100644 index 000000000..58b909cef --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/out/dependency/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture-dependency" +version = "0.0.0" + +[features] +one = [] +two = [] diff --git a/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/stderr.log b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/stderr.log new file mode 100644 index 000000000..554aa2ef3 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/stderr.log @@ -0,0 +1,4 @@ + Adding cargo-list-test-fixture-dependency (local) to build-dependencies. + Features: + - one + - two diff --git a/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/stdout.log b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/stdout.log new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/build_prefer_existing_version/stdout.log |