Skip to content

Commit

Permalink
test(publish): Check with multiple unpublishable packages
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jan 16, 2025
1 parent ac22fd3 commit a282233
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/testsuite/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4049,3 +4049,65 @@ fn one_unpublishable_package() {
"#]])
.run();
}

#[cargo_test]
fn multiple_unpublishable_package() {
let _alt_reg = registry::RegistryBuilder::new()
.http_api()
.http_index()
.alternative()
.build();

let p = project()
.file(
"Cargo.toml",
r#"
[workspace]
members = ["dep", "main"]
"#,
)
.file(
"main/Cargo.toml",
r#"
[package]
name = "main"
version = "0.0.1"
edition = "2015"
authors = []
license = "MIT"
description = "main"
repository = "bar"
publish = false
[dependencies]
dep = { path = "../dep", version = "0.1.0" }
"#,
)
.file("main/src/main.rs", "fn main() {}")
.file(
"dep/Cargo.toml",
r#"
[package]
name = "dep"
version = "0.1.0"
edition = "2015"
authors = []
license = "MIT"
description = "dep"
repository = "bar"
publish = false
"#,
)
.file("dep/src/lib.rs", "")
.build();

p.cargo("publish -Zpackage-workspace")
.masquerade_as_nightly_cargo(&["package-workspace"])
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] `dep` cannot be published.
`package.publish` must be set to `true` or a non-empty list in Cargo.toml to publish.
"#]])
.run();
}

0 comments on commit a282233

Please sign in to comment.