mirror of https://github.com/rust-lang/cargo
test(resolver): Verify some more msrv cases
This commit is contained in:
parent
39b8f1702e
commit
226b53ef31
|
@ -1,6 +1,6 @@
|
|||
//! Tests for targets with `rust-version`.
|
||||
|
||||
use cargo_test_support::{project, registry::Package};
|
||||
use cargo_test_support::{cargo_process, project, registry::Package};
|
||||
|
||||
#[cargo_test]
|
||||
fn rust_version_satisfied() {
|
||||
|
@ -605,6 +605,57 @@ See https://github.com/rust-lang/cargo/issues/9930 for more information about th
|
|||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn update_precise_overrides_msrv_resolver() {
|
||||
Package::new("bar", "1.5.0")
|
||||
.rust_version("1.55.0")
|
||||
.file("src/lib.rs", "fn other_stuff() {}")
|
||||
.publish();
|
||||
Package::new("bar", "1.6.0")
|
||||
.rust_version("1.65.0")
|
||||
.file("src/lib.rs", "fn other_stuff() {}")
|
||||
.publish();
|
||||
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
edition = "2015"
|
||||
authors = []
|
||||
rust-version = "1.60.0"
|
||||
[dependencies]
|
||||
bar = "1.0.0"
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main(){}")
|
||||
.build();
|
||||
|
||||
p.cargo("update")
|
||||
.arg("-Zmsrv-policy")
|
||||
.masquerade_as_nightly_cargo(&["msrv-policy"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[UPDATING] `dummy-registry` index
|
||||
[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
|
||||
[ADDING] bar v1.5.0 (latest: v1.6.0)
|
||||
",
|
||||
)
|
||||
.run();
|
||||
p.cargo("update --precise 1.6.0 bar")
|
||||
.arg("-Zmsrv-policy")
|
||||
.masquerade_as_nightly_cargo(&["msrv-policy"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[UPDATING] `dummy-registry` index
|
||||
[UPDATING] bar v1.5.0 -> v1.6.0
|
||||
",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn check_msrv_resolve() {
|
||||
Package::new("only-newer", "1.6.0")
|
||||
|
@ -693,3 +744,47 @@ foo v0.0.1 ([CWD])
|
|||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn cargo_install_ignores_msrv_config() {
|
||||
Package::new("dep", "1.0.0")
|
||||
.rust_version("1.50")
|
||||
.file("src/lib.rs", "fn hello() {}")
|
||||
.publish();
|
||||
Package::new("dep", "1.1.0")
|
||||
.rust_version("1.70")
|
||||
.file("src/lib.rs", "fn hello() {}")
|
||||
.publish();
|
||||
Package::new("foo", "0.0.1")
|
||||
.rust_version("1.60")
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.dep("dep", "1")
|
||||
.publish();
|
||||
|
||||
cargo_process("install foo")
|
||||
.env(
|
||||
"CARGO_RESOLVER_SOMETHING_LIKE_PRECEDENCE",
|
||||
"something-like-rust-version",
|
||||
)
|
||||
.arg("-Zmsrv-policy")
|
||||
.masquerade_as_nightly_cargo(&["msrv-policy"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[UPDATING] `[..]` index
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] foo v0.0.1 (registry [..])
|
||||
[INSTALLING] foo v0.0.1
|
||||
[LOCKING] 2 packages to latest Rust 1.60 compatible versions
|
||||
[ADDING] dep v1.0.0 (latest: v1.1.0)
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] dep v1.0.0 (registry [..])
|
||||
[COMPILING] dep v1.0.0
|
||||
[COMPILING] foo v0.0.1
|
||||
[FINISHED] `release` profile [optimized] target(s) in [..]
|
||||
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
|
||||
[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`)
|
||||
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
|
||||
",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue