Add metadata test for invalid publish field

This commit is contained in:
Robert DiMartino 2022-09-20 09:34:58 -04:00
parent 7a50c0c718
commit 7b16e59896

View file

@ -1754,6 +1754,30 @@ Caused by:
.run();
}
#[cargo_test]
fn cargo_metadata_with_invalid_publish_field() {
let p = project()
.file("src/foo.rs", "")
.file(
"Cargo.toml",
r#"
[package]
publish = "foo"
"#,
)
.build();
p.cargo("metadata")
.with_status(101)
.with_stderr(
r#"[ERROR] failed to parse manifest at `[..]`
Caused by:
invalid type: string "foo", expected a boolean or vector of strings for key `package.publish`"#,
)
.run();
}
const MANIFEST_OUTPUT: &str = r#"
{
"packages": [{