Skip to content

Commit a282233

Browse files
committed
test(publish): Check with multiple unpublishable packages
1 parent ac22fd3 commit a282233

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

tests/testsuite/publish.rs

+62
Original file line numberDiff line numberDiff line change
@@ -4049,3 +4049,65 @@ fn one_unpublishable_package() {
40494049
"#]])
40504050
.run();
40514051
}
4052+
4053+
#[cargo_test]
4054+
fn multiple_unpublishable_package() {
4055+
let _alt_reg = registry::RegistryBuilder::new()
4056+
.http_api()
4057+
.http_index()
4058+
.alternative()
4059+
.build();
4060+
4061+
let p = project()
4062+
.file(
4063+
"Cargo.toml",
4064+
r#"
4065+
[workspace]
4066+
members = ["dep", "main"]
4067+
"#,
4068+
)
4069+
.file(
4070+
"main/Cargo.toml",
4071+
r#"
4072+
[package]
4073+
name = "main"
4074+
version = "0.0.1"
4075+
edition = "2015"
4076+
authors = []
4077+
license = "MIT"
4078+
description = "main"
4079+
repository = "bar"
4080+
publish = false
4081+
4082+
[dependencies]
4083+
dep = { path = "../dep", version = "0.1.0" }
4084+
"#,
4085+
)
4086+
.file("main/src/main.rs", "fn main() {}")
4087+
.file(
4088+
"dep/Cargo.toml",
4089+
r#"
4090+
[package]
4091+
name = "dep"
4092+
version = "0.1.0"
4093+
edition = "2015"
4094+
authors = []
4095+
license = "MIT"
4096+
description = "dep"
4097+
repository = "bar"
4098+
publish = false
4099+
"#,
4100+
)
4101+
.file("dep/src/lib.rs", "")
4102+
.build();
4103+
4104+
p.cargo("publish -Zpackage-workspace")
4105+
.masquerade_as_nightly_cargo(&["package-workspace"])
4106+
.with_status(101)
4107+
.with_stderr_data(str![[r#"
4108+
[ERROR] `dep` cannot be published.
4109+
`package.publish` must be set to `true` or a non-empty list in Cargo.toml to publish.
4110+
4111+
"#]])
4112+
.run();
4113+
}

0 commit comments

Comments
 (0)