Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 30 additions & 17 deletions tests/testsuite/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2522,8 +2522,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.

#[cargo_test]
fn with_duplicate_spec_in_members() {
// Use local registry for faster test times since no publish will occur
let registry = registry::init();
let registry = RegistryBuilder::new().http_api().http_index().build();

let p = project()
.file(
Expand Down Expand Up @@ -2630,8 +2629,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.

#[cargo_test]
fn in_virtual_workspace() {
// Use local registry for faster test times since no publish will occur
let registry = registry::init();
let registry = RegistryBuilder::new().http_api().http_index().build();

let p = project()
.file(
Expand Down Expand Up @@ -2668,8 +2666,7 @@ fn in_virtual_workspace() {

#[cargo_test]
fn in_virtual_workspace_with_p() {
// `publish` generally requires a remote registry
let registry = registry::RegistryBuilder::new().http_api().build();
let registry = RegistryBuilder::new().http_api().http_index().build();

let p = project()
.file(
Expand Down Expand Up @@ -2771,8 +2768,7 @@ fn in_package_workspace_not_found() {

#[cargo_test]
fn in_package_workspace_found_multiple() {
// Use local registry for faster test times since no publish will occur
let registry = registry::init();
let registry = RegistryBuilder::new().http_api().http_index().build();

let p = project()
.file(
Expand Down Expand Up @@ -2828,8 +2824,7 @@ fn in_package_workspace_found_multiple() {
#[cargo_test]
// https://github.com/rust-lang/cargo/issues/10536
fn publish_path_dependency_without_workspace() {
// Use local registry for faster test times since no publish will occur
let registry = registry::init();
let registry = RegistryBuilder::new().http_api().http_index().build();

let p = project()
.file(
Expand Down Expand Up @@ -3403,7 +3398,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
}

#[cargo_test]
fn package_selection() {
fn package_selection_nightly() {
let registry = registry::RegistryBuilder::new().http_api().build();
let p = project()
.file(
Expand Down Expand Up @@ -3478,26 +3473,44 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
"#]])
.with_stdout_data(str![[r#""#]])
.run();
}

p.cargo("publish --no-verify --dry-run --package a --package b")
#[cargo_test]
fn package_selection() {
let registry = registry::RegistryBuilder::new().http_api().build();
let p = project()
.file(
"Cargo.toml",
r#"
[workspace]
members = ["a", "b"]
"#,
)
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
.file("a/src/lib.rs", "#[test] fn a() {}")
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
.file("b/src/lib.rs", "#[test] fn b() {}")
.build();

p.cargo("publish --no-verify --dry-run --workspace")
.replace_crates_io(registry.index_url())
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] the `--package (multiple occurrences)` flag is unstable, and only available on the nightly channel of Cargo, but this is the `stable` channel
[ERROR] the `--workspace` flag is unstable, and only available on the nightly channel of Cargo, but this is the `stable` channel
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
See https://github.com/rust-lang/cargo/issues/10948 for more information about the `--package (multiple occurrences)` flag.
See https://github.com/rust-lang/cargo/issues/10948 for more information about the `--workspace` flag.

"#]])
.with_stdout_data(str![[r#""#]])
.run();

p.cargo("publish --no-verify --dry-run --workspace")
p.cargo("publish --no-verify --dry-run --package a --package b")
.replace_crates_io(registry.index_url())
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] the `--workspace` flag is unstable, and only available on the nightly channel of Cargo, but this is the `stable` channel
[ERROR] the `--package (multiple occurrences)` flag is unstable, and only available on the nightly channel of Cargo, but this is the `stable` channel
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
See https://github.com/rust-lang/cargo/issues/10948 for more information about the `--workspace` flag.
See https://github.com/rust-lang/cargo/issues/10948 for more information about the `--package (multiple occurrences)` flag.

"#]])
.with_stdout_data(str![[r#""#]])
Expand Down