Skip to content

Commit 8728cca

Browse files
committed
test(resolver): Create baseline for `-Zdirect-minimal-versions
1 parent 82c3bb7 commit 8728cca

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//! Tests for minimal-version resolution.
2+
//!
3+
//! Note: Some tests are located in the resolver-tests package.
4+
5+
use cargo_test_support::project;
6+
use cargo_test_support::registry::Package;
7+
8+
// Ensure that the "-Z minimal-versions" CLI option works and the minimal
9+
// version of a dependency ends up in the lock file.
10+
#[cargo_test]
11+
fn minimal_version_cli() {
12+
Package::new("dep", "1.0.0").publish();
13+
Package::new("dep", "1.1.0").publish();
14+
15+
let p = project()
16+
.file(
17+
"Cargo.toml",
18+
r#"
19+
[package]
20+
name = "foo"
21+
authors = []
22+
version = "0.0.1"
23+
24+
[dependencies]
25+
dep = "1.0"
26+
"#,
27+
)
28+
.file("src/main.rs", "fn main() {}")
29+
.build();
30+
31+
p.cargo("generate-lockfile -Zminimal-versions")
32+
.masquerade_as_nightly_cargo(&["minimal-versions"])
33+
.run();
34+
35+
let lock = p.read_lockfile();
36+
37+
assert!(!lock.contains("1.1.0"));
38+
}

tests/testsuite/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ mod cross_publish;
4343
mod custom_target;
4444
mod death;
4545
mod dep_info;
46+
mod direct_minimal_versions;
4647
mod directory;
4748
mod doc;
4849
mod docscrape;

0 commit comments

Comments
 (0)