summaryrefslogtreecommitdiffstats
path: root/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git')
-rw-r--r--src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml8
-rw-r--r--src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/in/src/lib.rs0
-rw-r--r--src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/mod.rs34
-rw-r--r--src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml8
-rw-r--r--src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/stderr.log3
-rw-r--r--src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/stdout.log0
6 files changed, 53 insertions, 0 deletions
diff --git a/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml
new file mode 100644
index 000000000..fe41f2a90
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml
@@ -0,0 +1,8 @@
+[workspace]
+
+[package]
+name = "cargo-list-test-fixture"
+version = "0.0.0"
+
+[dependencies]
+versioned-package = { version = "0.1.1", optional = true }
diff --git a/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/in/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/in/src/lib.rs
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/in/src/lib.rs
diff --git a/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/mod.rs b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/mod.rs
new file mode 100644
index 000000000..ce7a0acb0
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/mod.rs
@@ -0,0 +1,34 @@
+use cargo_test_support::compare::assert_ui;
+use cargo_test_support::prelude::*;
+use cargo_test_support::Project;
+
+use crate::cargo_add::init_registry;
+use cargo_test_support::curr_dir;
+
+#[cargo_test]
+fn case() {
+ init_registry();
+ let project = Project::from_template(curr_dir!().join("in"));
+ let project_root = project.root();
+ let cwd = &project_root;
+ let git_dep = cargo_test_support::git::new("versioned-package", |project| {
+ project
+ .file(
+ "Cargo.toml",
+ &cargo_test_support::basic_manifest("versioned-package", "0.3.0+versioned-package"),
+ )
+ .file("src/lib.rs", "")
+ });
+ let git_url = git_dep.url().to_string();
+
+ snapbox::cmd::Command::cargo_ui()
+ .arg("add")
+ .args(["versioned-package", "--git", &git_url])
+ .current_dir(cwd)
+ .assert()
+ .success()
+ .stdout_matches_path(curr_dir!().join("stdout.log"))
+ .stderr_matches_path(curr_dir!().join("stderr.log"));
+
+ assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
+}
diff --git a/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml
new file mode 100644
index 000000000..260014024
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml
@@ -0,0 +1,8 @@
+[workspace]
+
+[package]
+name = "cargo-list-test-fixture"
+version = "0.0.0"
+
+[dependencies]
+versioned-package = { version = "0.3.0", optional = true, git = "[ROOTURL]/versioned-package" }
diff --git a/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/stderr.log b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/stderr.log
new file mode 100644
index 000000000..1b77cbe0e
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/stderr.log
@@ -0,0 +1,3 @@
+ Updating git repository `[ROOTURL]/versioned-package`
+ Adding versioned-package (git) to optional dependencies.
+ Updating git repository `[ROOTURL]/versioned-package`
diff --git a/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/stdout.log b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/stdout.log
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/cargo_add/overwrite_version_with_git/stdout.log