Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
test: add case for matching multiple versions from lockfile
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
  • Loading branch information
Rustin170506 committed Dec 2, 2023
1 parent 1071f79 commit 091ab5d
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/testsuite/cargo_information/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod features;
mod help;
mod not_found;
mod specify_version_outside_workspace;
mod specify_version_with_ws_and_match_multiple_versions;
mod specify_version_within_ws_and_conflict_with_lockfile;
mod specify_version_within_ws_and_match_with_lockfile;
mod with_frozen_outside_workspace;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["crate*"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "crate1"
version = "0.0.0"

[dependencies]
my-package = "=0.2.0+my-package"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "crate2"
version = "0.0.0"

[dependencies]
my-package = "=0.2.3+my-package"
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use cargo_test_macro::cargo_test;
use cargo_test_support::{compare::assert_ui, curr_dir, Project};

use super::{cargo_info, init_registry_without_token};

#[cargo_test]
fn case() {
init_registry_without_token();
for ver in [
"0.1.1+my-package",
"0.2.0+my-package",
"0.2.3+my-package",
"0.4.1+my-package",
] {
cargo_test_support::registry::Package::new("my-package", ver).publish();
}

let project = Project::from_template(curr_dir!().join("in"));
let project_root = project.root();
let cwd = &project_root;

cargo_info()
.arg("my-package@0.2")
.arg("--registry=dummy-registry")
.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);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["crate*"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "crate1"
version = "0.0.0"

[dependencies]
my-package = "=0.2.0+my-package"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "crate2"
version = "0.0.0"

[dependencies]
my-package = "=0.2.3+my-package"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Updating `dummy-registry` index
Downloading crates ...
Downloaded my-package v0.2.3+my-package (registry `dummy-registry`)
Updating crates.io index
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
my-package
version: 0.2.3+my-package (latest 0.4.1+my-package)
license: unknown
rust-version: unknown
documentation: https://docs.rs/my-package/0.2.3+my-package
note: to see how you depend on my-package, run `cargo tree --package my-package@0.2.3+my-package --invert`

0 comments on commit 091ab5d

Please sign in to comment.