Skip to content

Commit 0b801d1

Browse files
committed
test: Add test about update --breaking on prerelease
1 parent 8b1d18a commit 0b801d1

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

src/cargo/util/toml_mut/upgrade.rs

+5
Original file line numberDiff line numberDiff line change
@@ -217,5 +217,10 @@ mod test {
217217
assert_req_bump("1.1.1", "=1.0.0", "=1.1.1");
218218
assert_req_bump("2.0.0", "=1.0.0", "=2.0.0");
219219
}
220+
221+
#[test]
222+
fn caret_prerelease() {
223+
assert_req_bump("1.7.0", "2.0.0-beta.21", "1.7.0");
224+
}
220225
}
221226
}

tests/testsuite/update.rs

+37
Original file line numberDiff line numberDiff line change
@@ -2616,3 +2616,40 @@ fn update_breaking_mixed_pinning_renaming() {
26162616
"#]],
26172617
);
26182618
}
2619+
2620+
#[cargo_test]
2621+
fn update_breaking_pre_release() {
2622+
Package::new("bar", "2.0.0-beta.21").publish();
2623+
2624+
let p = project()
2625+
.file(
2626+
"Cargo.toml",
2627+
r#"
2628+
[package]
2629+
name = "foo"
2630+
version = "0.0.1"
2631+
edition = "2015"
2632+
authors = []
2633+
2634+
[dependencies]
2635+
bar = "2.0.0-beta.21"
2636+
"#,
2637+
)
2638+
.file("src/lib.rs", "")
2639+
.build();
2640+
2641+
p.cargo("generate-lockfile").run();
2642+
2643+
Package::new("bar", "1.7.0").publish();
2644+
2645+
p.cargo("update -Zunstable-options --breaking bar")
2646+
.masquerade_as_nightly_cargo(&["update-breaking"])
2647+
.with_stderr_data(str![[r#"
2648+
[UPDATING] `dummy-registry` index
2649+
[UPGRADING] bar ^2.0.0-beta.21 -> ^1.7.0
2650+
[LOCKING] 1 package to latest compatible version
2651+
[DOWNGRADING] bar v2.0.0-beta.21 -> v1.7.0
2652+
2653+
"#]])
2654+
.run();
2655+
}

0 commit comments

Comments
 (0)