Add test of update with version that differ only in build metadata

This commit is contained in:
David Tolnay 2023-10-09 10:34:44 -07:00
parent b48c41aedb
commit 4d1bf29a2c
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -391,6 +391,48 @@ fn update_precise() {
.run();
}
#[cargo_test]
fn update_precise_build_metadata() {
Package::new("serde", "0.0.1+first").publish();
Package::new("serde", "0.0.1+second").publish();
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.0"
[dependencies]
serde = "0.0.1"
"#,
)
.file("src/lib.rs", "")
.build();
p.cargo("generate-lockfile").run();
p.cargo("update serde --precise 0.0.1+first").run();
p.cargo("update serde --precise 0.0.1+second")
.with_stderr(
"\
[UPDATING] `[..]` index
[UPDATING] serde v0.0.1+first -> v0.0.1+second
",
)
.run();
p.cargo("update serde --precise 0.0.1+first")
.with_stderr(
"\
[UPDATING] `[..]` index
[DOWNGRADING] serde v0.0.1+second -> v0.0.1+first
",
)
.run();
}
#[cargo_test]
fn update_precise_do_not_force_update_deps() {
Package::new("log", "0.1.0").publish();