blob: ae428d9a99f5141ca678ed4da7a06cd7a727dc44 [file] [log] [blame]
use crate::support::project;
use crate::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()
.run();
let lock = p.read_lockfile();
assert!(lock.contains("dep 1.0.0"));
}