2019-11-25 02:42:45 +00:00
|
|
|
//! Tests for minimal-version resolution.
|
|
|
|
//!
|
|
|
|
//! Note: Some tests are located in the resolver-tests package.
|
|
|
|
|
2019-09-12 17:14:29 +00:00
|
|
|
use cargo_test_support::project;
|
|
|
|
use cargo_test_support::registry::Package;
|
2018-03-20 21:33:10 +00:00
|
|
|
|
2018-03-23 19:06:49 +00:00
|
|
|
// Ensure that the "-Z minimal-versions" CLI option works and the minimal
|
|
|
|
// version of a dependency ends up in the lock file.
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2018-03-23 19:06:49 +00:00
|
|
|
fn minimal_version_cli() {
|
|
|
|
Package::new("dep", "1.0.0").publish();
|
|
|
|
Package::new("dep", "1.1.0").publish();
|
|
|
|
|
2018-07-20 11:47:47 +00:00
|
|
|
let p = project()
|
2018-03-23 19:06:49 +00:00
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
r#"
|
2020-09-27 00:59:58 +00:00
|
|
|
[package]
|
|
|
|
name = "foo"
|
|
|
|
authors = []
|
|
|
|
version = "0.0.1"
|
2018-03-23 19:06:49 +00:00
|
|
|
|
2020-09-27 00:59:58 +00:00
|
|
|
[dependencies]
|
|
|
|
dep = "1.0"
|
|
|
|
"#,
|
2018-10-06 22:07:36 +00:00
|
|
|
)
|
|
|
|
.file("src/main.rs", "fn main() {}")
|
2018-03-23 19:06:49 +00:00
|
|
|
.build();
|
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("generate-lockfile -Zminimal-versions")
|
2022-07-16 02:32:23 +00:00
|
|
|
.masquerade_as_nightly_cargo(&["minimal-versions"])
|
2018-08-28 09:20:03 +00:00
|
|
|
.run();
|
2018-03-23 19:06:49 +00:00
|
|
|
|
|
|
|
let lock = p.read_lockfile();
|
|
|
|
|
2019-11-08 23:48:04 +00:00
|
|
|
assert!(!lock.contains("1.1.0"));
|
2018-03-23 19:06:49 +00:00
|
|
|
}
|