mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
test: verify publish failed with --index
and the only implicit allowed registry
The message is misleading and shouldn't proceed when `--index` presents.
This commit is contained in:
parent
e57ce13da8
commit
e883054c59
@ -921,6 +921,48 @@ You may press ctrl-c [..]
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn publish_failed_with_index_and_only_allowed_registry() {
|
||||||
|
let registry = RegistryBuilder::new()
|
||||||
|
.http_api()
|
||||||
|
.http_index()
|
||||||
|
.alternative()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let p = project().build();
|
||||||
|
|
||||||
|
let _ = repo(&paths::root().join("foo"))
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
authors = []
|
||||||
|
license = "MIT"
|
||||||
|
description = "foo"
|
||||||
|
documentation = "foo"
|
||||||
|
homepage = "foo"
|
||||||
|
repository = "foo"
|
||||||
|
publish = ["alternative"]
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/main.rs", "fn main() {}")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("publish")
|
||||||
|
.arg("--index")
|
||||||
|
.arg(registry.index_url().as_str())
|
||||||
|
.with_status(101)
|
||||||
|
.with_stderr(
|
||||||
|
"\
|
||||||
|
[NOTE] Found `alternative` as only allowed registry. Publishing to it automatically.
|
||||||
|
[ERROR] command-line argument --index requires --token to be specified
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn publish_fail_with_no_registry_specified() {
|
fn publish_fail_with_no_registry_specified() {
|
||||||
let p = project().build();
|
let p = project().build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user