From 3d2f3717372ce6276e8eeb4d0413aa2833e23776 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 29 Aug 2023 10:40:47 -0500 Subject: [PATCH] test(pkgid): Add cases for partial versions --- tests/testsuite/pkgid.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/testsuite/pkgid.rs b/tests/testsuite/pkgid.rs index f9f42edd2..7cb633485 100644 --- a/tests/testsuite/pkgid.rs +++ b/tests/testsuite/pkgid.rs @@ -146,6 +146,34 @@ fn multiple_versions() { .with_stdout("https://github.com/rust-lang/crates.io-index#two-ver@0.2.0") .run(); + // Incomplete version. + p.cargo("pkgid two-ver@0") + .with_status(101) + .with_stderr( + "\ +error: invalid package ID specification: `two-ver@0` + +Did you mean `two-ver`? + +Caused by: + cannot parse '0' as a semver +", + ) + .run(); + + // Incomplete version. + p.cargo("pkgid two-ver@0.2") + .with_status(101) + .with_stderr( + "\ +error: invalid package ID specification: `two-ver@0.2` + +Caused by: + cannot parse '0.2' as a semver +", + ) + .run(); + // Ambiguous. p.cargo("pkgid two-ver") .with_status(101)