Skip to content

Commit 3d2f371

Browse files
committed
test(pkgid): Add cases for partial versions
1 parent 018b758 commit 3d2f371

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/testsuite/pkgid.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,34 @@ fn multiple_versions() {
146146
.with_stdout("https://github.com/rust-lang/crates.io-index#two-ver@0.2.0")
147147
.run();
148148

149+
// Incomplete version.
150+
p.cargo("pkgid two-ver@0")
151+
.with_status(101)
152+
.with_stderr(
153+
"\
154+
error: invalid package ID specification: `two-ver@0`
155+
156+
<tab>Did you mean `two-ver`?
157+
158+
Caused by:
159+
cannot parse '0' as a semver
160+
",
161+
)
162+
.run();
163+
164+
// Incomplete version.
165+
p.cargo("pkgid two-ver@0.2")
166+
.with_status(101)
167+
.with_stderr(
168+
"\
169+
error: invalid package ID specification: `two-ver@0.2`
170+
171+
Caused by:
172+
cannot parse '0.2' as a semver
173+
",
174+
)
175+
.run();
176+
149177
// Ambiguous.
150178
p.cargo("pkgid two-ver")
151179
.with_status(101)

0 commit comments

Comments
 (0)