Skip to content

Commit fdc4f95

Browse files
committed
test(package): add baseline tests for global metadata warnings
1 parent e2c8f3c commit fdc4f95

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

tests/testsuite/package.rs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7739,3 +7739,75 @@ Caused by:
77397739
"#]])
77407740
.run();
77417741
}
7742+
7743+
#[cargo_test]
7744+
fn publish_to_crates_io_warns() {
7745+
let p = project()
7746+
.file(
7747+
"Cargo.toml",
7748+
r#"
7749+
[package]
7750+
name = "foo"
7751+
version = "0.1.0"
7752+
description = "foo"
7753+
edition = "2015"
7754+
"#,
7755+
)
7756+
.file("src/main.rs", "fn main() {}")
7757+
.build();
7758+
7759+
p.cargo(&format!("publish --dry-run"))
7760+
.with_stderr_data(str![[r#"
7761+
[UPDATING] crates.io index
7762+
[WARNING] manifest has no license, license-file, documentation, homepage or repository
7763+
|
7764+
= [NOTE] see https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info
7765+
[PACKAGING] foo v0.1.0 ([ROOT]/foo)
7766+
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
7767+
[VERIFYING] foo v0.1.0 ([ROOT]/foo)
7768+
[COMPILING] foo v0.1.0 ([ROOT]/foo/target/package/foo-0.1.0)
7769+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
7770+
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
7771+
[WARNING] aborting upload due to dry run
7772+
7773+
"#]])
7774+
.run();
7775+
}
7776+
7777+
#[cargo_test]
7778+
fn publish_to_alt_registry_warns() {
7779+
let _alt_reg = registry::RegistryBuilder::new().alternative().build();
7780+
7781+
let p = project()
7782+
.file(
7783+
"Cargo.toml",
7784+
r#"
7785+
[package]
7786+
name = "foo"
7787+
version = "0.1.0"
7788+
description = "foo"
7789+
edition = "2015"
7790+
publish = ["alternative"]
7791+
"#,
7792+
)
7793+
.file("src/main.rs", "fn main() {}")
7794+
.build();
7795+
7796+
// There will be no warnings for alternative registry in the next commit
7797+
p.cargo("publish --dry-run --registry alternative")
7798+
.with_stderr_data(str![[r#"
7799+
[UPDATING] `alternative` index
7800+
[WARNING] manifest has no license, license-file, documentation, homepage or repository
7801+
|
7802+
= [NOTE] see https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info
7803+
[PACKAGING] foo v0.1.0 ([ROOT]/foo)
7804+
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
7805+
[VERIFYING] foo v0.1.0 ([ROOT]/foo)
7806+
[COMPILING] foo v0.1.0 ([ROOT]/foo/target/package/foo-0.1.0)
7807+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
7808+
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
7809+
[WARNING] aborting upload due to dry run
7810+
7811+
"#]])
7812+
.run();
7813+
}

0 commit comments

Comments
 (0)