mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
failing tests on empty readme and license-path fields
This commit is contained in:
parent
1cd4ef32fb
commit
27e95997ce
@ -1774,6 +1774,142 @@ fn exclude_dot_files_and_directories_by_default() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn empty_readme_path() {
|
||||||
|
// Warn but don't fail if `readme` is empty.
|
||||||
|
// Issue #11522.
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "1.0.0"
|
||||||
|
readme = ""
|
||||||
|
license = "MIT"
|
||||||
|
description = "foo"
|
||||||
|
homepage = "foo"
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/lib.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("package --no-verify")
|
||||||
|
.with_stderr(
|
||||||
|
"\
|
||||||
|
[WARNING] readme `` does not appear to exist (relative to `[..]/foo`).
|
||||||
|
Please update the readme setting in the manifest at `[..]/foo/Cargo.toml`
|
||||||
|
This may become a hard error in the future.
|
||||||
|
[PACKAGING] foo v1.0.0 ([..]/foo)
|
||||||
|
[PACKAGED] [..] files, [..] ([..] compressed)
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn invalid_readme_path() {
|
||||||
|
// Warn but don't fail if `readme` path is invalid.
|
||||||
|
// Issue #11522.
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "1.0.0"
|
||||||
|
readme = "DOES-NOT-EXIST"
|
||||||
|
license = "MIT"
|
||||||
|
description = "foo"
|
||||||
|
homepage = "foo"
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/lib.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("package --no-verify")
|
||||||
|
.with_stderr(
|
||||||
|
"\
|
||||||
|
[WARNING] readme `DOES-NOT-EXIST` does not appear to exist (relative to `[..]/foo`).
|
||||||
|
Please update the readme setting in the manifest at `[..]/foo/Cargo.toml`
|
||||||
|
This may become a hard error in the future.
|
||||||
|
[PACKAGING] foo v1.0.0 ([..]/foo)
|
||||||
|
[PACKAGED] [..] files, [..] ([..] compressed)
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn readme_or_license_file_is_dir() {
|
||||||
|
// Test warning when `readme` or `license-file` is a directory, not a file.
|
||||||
|
// Issue #11522.
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "1.0.0"
|
||||||
|
readme = "./src"
|
||||||
|
license-file = "./src"
|
||||||
|
description = "foo"
|
||||||
|
homepage = "foo"
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/lib.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("package --no-verify")
|
||||||
|
.with_stderr(
|
||||||
|
"\
|
||||||
|
[WARNING] license-file `./src` does not appear to exist (relative to `[..]/foo`).
|
||||||
|
Please update the license-file setting in the manifest at `[..]/foo/Cargo.toml`
|
||||||
|
This may become a hard error in the future.
|
||||||
|
[WARNING] readme `./src` does not appear to exist (relative to `[..]/foo`).
|
||||||
|
Please update the readme setting in the manifest at `[..]/foo/Cargo.toml`
|
||||||
|
This may become a hard error in the future.
|
||||||
|
[PACKAGING] foo v1.0.0 ([..]/foo)
|
||||||
|
[PACKAGED] [..] files, [..] ([..] compressed)
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn empty_license_file_path() {
|
||||||
|
// Warn but don't fail if license-file is empty.
|
||||||
|
// Issue #11522.
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "1.0.0"
|
||||||
|
license-file = ""
|
||||||
|
description = "foo"
|
||||||
|
homepage = "foo"
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/lib.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("package --no-verify")
|
||||||
|
.with_stderr(
|
||||||
|
"\
|
||||||
|
[WARNING] manifest has no license or license-file.
|
||||||
|
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||||
|
[WARNING] license-file `` does not appear to exist (relative to `[..]/foo`).
|
||||||
|
Please update the license-file setting in the manifest at `[..]/foo/Cargo.toml`
|
||||||
|
This may become a hard error in the future.
|
||||||
|
[PACKAGING] foo v1.0.0 ([..]/foo)
|
||||||
|
[PACKAGED] [..] files, [..] ([..] compressed)
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn invalid_license_file_path() {
|
fn invalid_license_file_path() {
|
||||||
// Test warning when license-file points to a non-existent file.
|
// Test warning when license-file points to a non-existent file.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user