mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
test(resolver): Create baseline for `-Zdirect-minimal-versions
This commit is contained in:
parent
c65a4d147c
commit
12000a9273
38
tests/testsuite/direct_minimal_versions.rs
Normal file
38
tests/testsuite/direct_minimal_versions.rs
Normal file
@ -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"));
|
||||||
|
}
|
@ -42,6 +42,7 @@ mod cross_publish;
|
|||||||
mod custom_target;
|
mod custom_target;
|
||||||
mod death;
|
mod death;
|
||||||
mod dep_info;
|
mod dep_info;
|
||||||
|
mod direct_minimal_versions;
|
||||||
mod directory;
|
mod directory;
|
||||||
mod doc;
|
mod doc;
|
||||||
mod docscrape;
|
mod docscrape;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user