Skip to content

Commit 4d1bf29

Browse files
committed
Add test of update with version that differ only in build metadata
1 parent b48c41a commit 4d1bf29

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/testsuite/update.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,48 @@ fn update_precise() {
391391
.run();
392392
}
393393

394+
#[cargo_test]
395+
fn update_precise_build_metadata() {
396+
Package::new("serde", "0.0.1+first").publish();
397+
Package::new("serde", "0.0.1+second").publish();
398+
399+
let p = project()
400+
.file(
401+
"Cargo.toml",
402+
r#"
403+
[package]
404+
name = "foo"
405+
version = "0.0.0"
406+
407+
[dependencies]
408+
serde = "0.0.1"
409+
"#,
410+
)
411+
.file("src/lib.rs", "")
412+
.build();
413+
414+
p.cargo("generate-lockfile").run();
415+
p.cargo("update serde --precise 0.0.1+first").run();
416+
417+
p.cargo("update serde --precise 0.0.1+second")
418+
.with_stderr(
419+
"\
420+
[UPDATING] `[..]` index
421+
[UPDATING] serde v0.0.1+first -> v0.0.1+second
422+
",
423+
)
424+
.run();
425+
426+
p.cargo("update serde --precise 0.0.1+first")
427+
.with_stderr(
428+
"\
429+
[UPDATING] `[..]` index
430+
[DOWNGRADING] serde v0.0.1+second -> v0.0.1+first
431+
",
432+
)
433+
.run();
434+
}
435+
394436
#[cargo_test]
395437
fn update_precise_do_not_force_update_deps() {
396438
Package::new("log", "0.1.0").publish();

0 commit comments

Comments
 (0)