teset(pkgid): suggestion for bad parsing

This commit is contained in:
Weihang Lo 2021-03-02 16:18:21 +08:00
parent a22b3ac207
commit ade33c20d1
No known key found for this signature in database
GPG key ID: D7DBF189825E82E7

View file

@ -54,6 +54,7 @@ fn suggestion_bad_pkgid() {
"#,
)
.file("src/lib.rs", "")
.file("cratesio", "")
.build();
p.cargo("generate-lockfile").run();
@ -106,6 +107,21 @@ error: invalid package ID specification: `./Cargo.toml`
Caused by:
package ID specification `./Cargo.toml` looks like a file path, maybe try file://[..]/Cargo.toml
",
)
.run();
// Bad file URL with simliar name.
p.cargo("pkgid './cratesio'")
.with_status(101)
.with_stderr(
"\
error: invalid package ID specification: `./cratesio`
<tab>Did you mean `crates-io`?
Caused by:
package ID specification `./cratesio` looks like a file path, maybe try file://[..]/cratesio
",
)
.run();