Skip to content

Commit 3c388cd

Browse files
committed
test(update): Added test for prefixed v in version
1 parent 5323377 commit 3c388cd

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/testsuite/update.rs

+38
Original file line numberDiff line numberDiff line change
@@ -2709,3 +2709,41 @@ fn update_breaking_pre_release_upgrade() {
27092709
"#]])
27102710
.run();
27112711
}
2712+
2713+
#[cargo_test]
2714+
fn prefixed_v_in_version() {
2715+
Package::new("bar", "1.0.0").publish();
2716+
2717+
let p = project()
2718+
.file(
2719+
"Cargo.toml",
2720+
r#"
2721+
[package]
2722+
name = "foo"
2723+
version = "0.0.1"
2724+
edition = "2015"
2725+
authors = []
2726+
2727+
[dependencies]
2728+
bar = "1.0.0"
2729+
"#,
2730+
)
2731+
.file("src/lib.rs", "")
2732+
.build();
2733+
2734+
p.cargo("generate-lockfile").run();
2735+
2736+
Package::new("bar", "1.0.1").publish();
2737+
p.cargo("update bar --precise v1.0.1")
2738+
.with_status(101)
2739+
.with_stderr_data(str![[r#"
2740+
[ERROR] the version provided, `v1.0.1` is not a valid SemVer version
2741+
2742+
[HELP] try changing the version to `1.0.1`
2743+
2744+
Caused by:
2745+
unexpected character 'v' while parsing major version number
2746+
2747+
"#]])
2748+
.run();
2749+
}

0 commit comments

Comments
 (0)