mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
test(lockfile): default lockfile version is still v3
It will become v4 when we changes the default.
This commit is contained in:
parent
f30f909756
commit
f3672cbf39
@ -1175,6 +1175,26 @@ fn v4_and_git_url_encoded_rev() {
|
|||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn with_msrv() {
|
fn with_msrv() {
|
||||||
let cksum = Package::new("bar", "0.1.0").publish();
|
let cksum = Package::new("bar", "0.1.0").publish();
|
||||||
|
|
||||||
|
let v3_lockfile = format!(
|
||||||
|
r#"# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bar"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "{cksum}"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
dependencies = [
|
||||||
|
"bar",
|
||||||
|
]
|
||||||
|
"#
|
||||||
|
);
|
||||||
let v2_lockfile = format!(
|
let v2_lockfile = format!(
|
||||||
r#"# This file is automatically @generated by Cargo.
|
r#"# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
@ -1258,6 +1278,14 @@ dependencies = [
|
|||||||
("1.53", Some(4), 4),
|
("1.53", Some(4), 4),
|
||||||
// v4 introduced
|
// v4 introduced
|
||||||
("1.78", None, 3),
|
("1.78", None, 3),
|
||||||
|
// last version of v3 as the default
|
||||||
|
("1.82", None, 3),
|
||||||
|
// v4 is the default
|
||||||
|
("1.83", None, 3),
|
||||||
|
("1.83", Some(1), 1),
|
||||||
|
("1.83", Some(2), 2),
|
||||||
|
("1.83", Some(3), 3),
|
||||||
|
("1.83", Some(4), 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
for (msrv, existing_lockfile, expected_version) in cases {
|
for (msrv, existing_lockfile, expected_version) in cases {
|
||||||
@ -1284,6 +1312,7 @@ dependencies = [
|
|||||||
let existing_lockfile = match existing_lockfile {
|
let existing_lockfile = match existing_lockfile {
|
||||||
1 => v1_lockfile.as_str().into(),
|
1 => v1_lockfile.as_str().into(),
|
||||||
2 => v2_lockfile.as_str().into(),
|
2 => v2_lockfile.as_str().into(),
|
||||||
|
3 => v3_lockfile.as_str().into(),
|
||||||
v => std::borrow::Cow::from(format!("version = {v}")),
|
v => std::borrow::Cow::from(format!("version = {v}")),
|
||||||
};
|
};
|
||||||
p.change_file("Cargo.lock", &existing_lockfile);
|
p.change_file("Cargo.lock", &existing_lockfile);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user