From 10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:41:41 +0200 Subject: Merging upstream version 1.70.0+dfsg2. Signed-off-by: Daniel Baumann --- .../cargo/tests/testsuite/minimal_versions.rs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/tools/cargo/tests/testsuite/minimal_versions.rs (limited to 'src/tools/cargo/tests/testsuite/minimal_versions.rs') diff --git a/src/tools/cargo/tests/testsuite/minimal_versions.rs b/src/tools/cargo/tests/testsuite/minimal_versions.rs new file mode 100644 index 000000000..f814dcb70 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/minimal_versions.rs @@ -0,0 +1,38 @@ +//! Tests for minimal-version resolution. +//! +//! Note: Some tests are located in the resolver-tests package. + +use cargo_test_support::project; +use cargo_test_support::registry::Package; + +// Ensure that the "-Z minimal-versions" CLI option works and the minimal +// version of a dependency ends up in the lock file. +#[cargo_test] +fn minimal_version_cli() { + Package::new("dep", "1.0.0").publish(); + Package::new("dep", "1.1.0").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + authors = [] + version = "0.0.1" + + [dependencies] + dep = "1.0" + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + p.cargo("generate-lockfile -Zminimal-versions") + .masquerade_as_nightly_cargo(&["minimal-versions"]) + .run(); + + let lock = p.read_lockfile(); + + assert!(!lock.contains("1.1.0")); +} -- cgit v1.2.3