Skip to content

Commit f3672cb

Browse files
committed
test(lockfile): default lockfile version is still v3
It will become v4 when we changes the default.
1 parent f30f909 commit f3672cb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/testsuite/lockfile_compat.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,26 @@ fn v4_and_git_url_encoded_rev() {
11751175
#[cargo_test]
11761176
fn with_msrv() {
11771177
let cksum = Package::new("bar", "0.1.0").publish();
1178+
1179+
let v3_lockfile = format!(
1180+
r#"# This file is automatically @generated by Cargo.
1181+
# It is not intended for manual editing.
1182+
version = 3
1183+
1184+
[[package]]
1185+
name = "bar"
1186+
version = "0.1.0"
1187+
source = "registry+https://github.com/rust-lang/crates.io-index"
1188+
checksum = "{cksum}"
1189+
1190+
[[package]]
1191+
name = "foo"
1192+
version = "0.0.1"
1193+
dependencies = [
1194+
"bar",
1195+
]
1196+
"#
1197+
);
11781198
let v2_lockfile = format!(
11791199
r#"# This file is automatically @generated by Cargo.
11801200
# It is not intended for manual editing.
@@ -1258,6 +1278,14 @@ dependencies = [
12581278
("1.53", Some(4), 4),
12591279
// v4 introduced
12601280
("1.78", None, 3),
1281+
// last version of v3 as the default
1282+
("1.82", None, 3),
1283+
// v4 is the default
1284+
("1.83", None, 3),
1285+
("1.83", Some(1), 1),
1286+
("1.83", Some(2), 2),
1287+
("1.83", Some(3), 3),
1288+
("1.83", Some(4), 4),
12611289
];
12621290

12631291
for (msrv, existing_lockfile, expected_version) in cases {
@@ -1284,6 +1312,7 @@ dependencies = [
12841312
let existing_lockfile = match existing_lockfile {
12851313
1 => v1_lockfile.as_str().into(),
12861314
2 => v2_lockfile.as_str().into(),
1315+
3 => v3_lockfile.as_str().into(),
12871316
v => std::borrow::Cow::from(format!("version = {v}")),
12881317
};
12891318
p.change_file("Cargo.lock", &existing_lockfile);

0 commit comments

Comments
 (0)