From 2aadc03ef15cb5ca5cc2af8a7c08e070742f0ac4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:47:55 +0200 Subject: Adding upstream version 0.70.1+ds1. Signed-off-by: Daniel Baumann --- tests/testsuite/cargo_add/git_rev/in | 1 + tests/testsuite/cargo_add/git_rev/mod.rs | 36 ++++++++++++++++++++++++ tests/testsuite/cargo_add/git_rev/out/Cargo.toml | 8 ++++++ tests/testsuite/cargo_add/git_rev/stderr.log | 3 ++ tests/testsuite/cargo_add/git_rev/stdout.log | 0 5 files changed, 48 insertions(+) create mode 120000 tests/testsuite/cargo_add/git_rev/in create mode 100644 tests/testsuite/cargo_add/git_rev/mod.rs create mode 100644 tests/testsuite/cargo_add/git_rev/out/Cargo.toml create mode 100644 tests/testsuite/cargo_add/git_rev/stderr.log create mode 100644 tests/testsuite/cargo_add/git_rev/stdout.log (limited to 'tests/testsuite/cargo_add/git_rev') diff --git a/tests/testsuite/cargo_add/git_rev/in b/tests/testsuite/cargo_add/git_rev/in new file mode 120000 index 0000000..6c6a27f --- /dev/null +++ b/tests/testsuite/cargo_add/git_rev/in @@ -0,0 +1 @@ +../add-basic.in \ No newline at end of file diff --git a/tests/testsuite/cargo_add/git_rev/mod.rs b/tests/testsuite/cargo_add/git_rev/mod.rs new file mode 100644 index 0000000..6126072 --- /dev/null +++ b/tests/testsuite/cargo_add/git_rev/mod.rs @@ -0,0 +1,36 @@ +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, git_repo) = cargo_test_support::git::new_repo("git-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), + ) + .file("src/lib.rs", "") + }); + let find_head = || (git_repo.head().unwrap().peel_to_commit().unwrap()); + let head = find_head().id().to_string(); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo_ui() + .arg("add") + .args(["git-package", "--git", &git_url, "--rev", &head]) + .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/tests/testsuite/cargo_add/git_rev/out/Cargo.toml b/tests/testsuite/cargo_add/git_rev/out/Cargo.toml new file mode 100644 index 0000000..efc00a0 --- /dev/null +++ b/tests/testsuite/cargo_add/git_rev/out/Cargo.toml @@ -0,0 +1,8 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" + +[dependencies] +git-package = { git = "[ROOTURL]/git-package", rev = "[..]", version = "0.3.0" } diff --git a/tests/testsuite/cargo_add/git_rev/stderr.log b/tests/testsuite/cargo_add/git_rev/stderr.log new file mode 100644 index 0000000..839d8bb --- /dev/null +++ b/tests/testsuite/cargo_add/git_rev/stderr.log @@ -0,0 +1,3 @@ + Updating git repository `[ROOTURL]/git-package` + Adding git-package (git) to dependencies. + Updating git repository `[ROOTURL]/git-package` diff --git a/tests/testsuite/cargo_add/git_rev/stdout.log b/tests/testsuite/cargo_add/git_rev/stdout.log new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3