Skip to content

Commit 89cf552

Browse files
committed
test(resolve): Explicitly verify msrv report
1 parent 388bb07 commit 89cf552

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

tests/testsuite/rust_version.rs

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,3 +1076,117 @@ fn cargo_install_ignores_msrv_config() {
10761076
"#]])
10771077
.run();
10781078
}
1079+
1080+
#[cargo_test]
1081+
fn report_rust_versions() {
1082+
Package::new("dep-only-low-compatible", "1.55.0")
1083+
.rust_version("1.55.0")
1084+
.file("src/lib.rs", "fn other_stuff() {}")
1085+
.publish();
1086+
Package::new("dep-only-low-incompatible", "1.75.0")
1087+
.rust_version("1.75.0")
1088+
.file("src/lib.rs", "fn other_stuff() {}")
1089+
.publish();
1090+
Package::new("dep-only-high-compatible", "1.65.0")
1091+
.rust_version("1.65.0")
1092+
.file("src/lib.rs", "fn other_stuff() {}")
1093+
.publish();
1094+
Package::new("dep-only-high-incompatible", "1.75.0")
1095+
.rust_version("1.75.0")
1096+
.file("src/lib.rs", "fn other_stuff() {}")
1097+
.publish();
1098+
Package::new("dep-only-unset-unset", "1.0.0")
1099+
.file("src/lib.rs", "fn other_stuff() {}")
1100+
.publish();
1101+
Package::new("dep-only-unset-compatible", "1.75.0")
1102+
.rust_version("1.75.0")
1103+
.file("src/lib.rs", "fn other_stuff() {}")
1104+
.publish();
1105+
Package::new("dep-only-unset-incompatible", "1.2345.0")
1106+
.rust_version("1.2345.0")
1107+
.file("src/lib.rs", "fn other_stuff() {}")
1108+
.publish();
1109+
Package::new("dep-shared-compatible", "1.55.0")
1110+
.rust_version("1.55.0")
1111+
.file("src/lib.rs", "fn other_stuff() {}")
1112+
.publish();
1113+
Package::new("dep-shared-incompatible", "1.75.0")
1114+
.rust_version("1.75.0")
1115+
.file("src/lib.rs", "fn other_stuff() {}")
1116+
.publish();
1117+
1118+
let p = project()
1119+
.file(
1120+
"Cargo.toml",
1121+
r#"
1122+
[workspace]
1123+
members = ["high", "low", "unset"]
1124+
"#,
1125+
)
1126+
.file(
1127+
"high/Cargo.toml",
1128+
r#"
1129+
[package]
1130+
name = "high"
1131+
edition = "2015"
1132+
rust-version = "1.70.0"
1133+
1134+
[dependencies]
1135+
dep-only-high-compatible = "1"
1136+
dep-only-high-incompatible = "1"
1137+
dep-shared-compatible = "1"
1138+
dep-shared-incompatible = "1"
1139+
"#,
1140+
)
1141+
.file("high/src/main.rs", "fn main(){}")
1142+
.file(
1143+
"low/Cargo.toml",
1144+
r#"
1145+
[package]
1146+
name = "low"
1147+
edition = "2015"
1148+
rust-version = "1.60.0"
1149+
1150+
[dependencies]
1151+
dep-only-low-compatible = "1"
1152+
dep-only-low-incompatible = "1"
1153+
dep-shared-compatible = "1"
1154+
dep-shared-incompatible = "1"
1155+
"#,
1156+
)
1157+
.file("low/src/main.rs", "fn main(){}")
1158+
.file(
1159+
"unset/Cargo.toml",
1160+
r#"
1161+
[package]
1162+
name = "unset"
1163+
edition = "2015"
1164+
1165+
[dependencies]
1166+
dep-only-unset-unset = "1"
1167+
dep-only-unset-compatible = "1"
1168+
dep-only-unset-incompatible = "1"
1169+
dep-shared-compatible = "1"
1170+
dep-shared-incompatible = "1"
1171+
"#,
1172+
)
1173+
.file("unset/src/main.rs", "fn main(){}")
1174+
.build();
1175+
1176+
p.cargo("update")
1177+
.env("CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS", "fallback")
1178+
.arg("-Zmsrv-policy")
1179+
.masquerade_as_nightly_cargo(&["msrv-policy"])
1180+
.with_stderr_data(str![[r#"
1181+
[UPDATING] `dummy-registry` index
1182+
[LOCKING] 9 packages to latest Rust 1.60.0 compatible versions
1183+
[ADDING] dep-only-high-compatible v1.65.0 (requires Rust 1.65.0)
1184+
[ADDING] dep-only-high-incompatible v1.75.0 (requires Rust 1.75.0)
1185+
[ADDING] dep-only-low-incompatible v1.75.0 (requires Rust 1.75.0)
1186+
[ADDING] dep-only-unset-compatible v1.75.0 (requires Rust 1.75.0)
1187+
[ADDING] dep-only-unset-incompatible v1.2345.0 (requires Rust 1.2345.0)
1188+
[ADDING] dep-shared-incompatible v1.75.0 (requires Rust 1.75.0)
1189+
1190+
"#]])
1191+
.run();
1192+
}

0 commit comments

Comments
 (0)