Skip to content

Commit

Permalink
Linewrap the error message from check_metadata.
Browse files Browse the repository at this point in the history
This lets test result expected output pass the long-line style check.
  • Loading branch information
rillian committed Sep 1, 2016
1 parent 4f01c02 commit 3227546
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn check_metadata(pkg: &Package, config: &Config) -> CargoResult<()> {
things.push_str(&missing.last().unwrap());

try!(config.shell().warn(
&format!("manifest has no {things}. \
&format!("manifest has no {things}.\n\
See http://doc.crates.io/manifest.html#package-metadata for more info.",
things = things)))
}
Expand Down
20 changes: 15 additions & 5 deletions tests/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn simple() {
assert_that(p.cargo_process("package"),
execs().with_status(0).with_stderr(&format!("\
[WARNING] manifest has no documentation[..]
See [..]
[PACKAGING] foo v0.0.1 ({dir})
[VERIFYING] foo v0.0.1 ({dir})
[COMPILING] foo v0.0.1 ({dir}[..])
Expand Down Expand Up @@ -82,8 +83,8 @@ fn metadata_warning() {
assert_that(p.cargo_process("package"),
execs().with_status(0).with_stderr(&format!("\
warning: manifest has no description, license, license-file, documentation, \
homepage or repository. See \
http://doc.crates.io/manifest.html#package-metadata for more info.
homepage or repository.
See http://doc.crates.io/manifest.html#package-metadata for more info.
[PACKAGING] foo v0.0.1 ({dir})
[VERIFYING] foo v0.0.1 ({dir})
[COMPILING] foo v0.0.1 ({dir}[..])
Expand All @@ -104,8 +105,8 @@ http://doc.crates.io/manifest.html#package-metadata for more info.
"#);
assert_that(p.cargo_process("package"),
execs().with_status(0).with_stderr(&format!("\
warning: manifest has no description, documentation, homepage or repository. See \
http://doc.crates.io/manifest.html#package-metadata for more info.
warning: manifest has no description, documentation, homepage or repository.
See http://doc.crates.io/manifest.html#package-metadata for more info.
[PACKAGING] foo v0.0.1 ({dir})
[VERIFYING] foo v0.0.1 ({dir})
[COMPILING] foo v0.0.1 ({dir}[..])
Expand Down Expand Up @@ -165,6 +166,7 @@ fn package_verbose() {
assert_that(cargo.clone().arg("package").arg("-v").arg("--no-verify"),
execs().with_status(0).with_stderr("\
[WARNING] manifest has no description[..]
See http://doc.crates.io/manifest.html#package-metadata for more info.
[PACKAGING] foo v0.0.1 ([..])
[ARCHIVING] [..]
[ARCHIVING] [..]
Expand All @@ -175,6 +177,7 @@ fn package_verbose() {
.cwd(p.root().join("a")),
execs().with_status(0).with_stderr("\
[WARNING] manifest has no description[..]
See http://doc.crates.io/manifest.html#package-metadata for more info.
[PACKAGING] a v0.0.1 ([..])
[ARCHIVING] [..]
[ARCHIVING] [..]
Expand All @@ -198,6 +201,7 @@ fn package_verification() {
assert_that(p.cargo("package"),
execs().with_status(0).with_stderr(&format!("\
[WARNING] manifest has no description[..]
See http://doc.crates.io/manifest.html#package-metadata for more info.
[PACKAGING] foo v0.0.1 ({dir})
[VERIFYING] foo v0.0.1 ({dir})
[COMPILING] foo v0.0.1 ({dir}[..])
Expand Down Expand Up @@ -231,7 +235,8 @@ fn path_dependency_no_version() {

assert_that(p.cargo_process("package"),
execs().with_status(101).with_stderr("\
[WARNING] manifest has no documentation, homepage or repository. See http://doc.crates.io/manifest.html#package-metadata for more info.
[WARNING] manifest has no documentation, homepage or repository.
See http://doc.crates.io/manifest.html#package-metadata for more info.
[ERROR] all path dependencies must have a version specified when packaging.
dependency `bar` does not specify a version.
"));
Expand All @@ -256,6 +261,7 @@ fn exclude() {
assert_that(p.cargo_process("package").arg("--no-verify").arg("-v"),
execs().with_status(0).with_stderr("\
[WARNING] manifest has no description[..]
See http://doc.crates.io/manifest.html#package-metadata for more info.
[PACKAGING] foo v0.0.1 ([..])
[ARCHIVING] [..]
[ARCHIVING] [..]
Expand All @@ -282,6 +288,7 @@ fn include() {
assert_that(p.cargo_process("package").arg("--no-verify").arg("-v"),
execs().with_status(0).with_stderr("\
[WARNING] manifest has no description[..]
See http://doc.crates.io/manifest.html#package-metadata for more info.
[PACKAGING] foo v0.0.1 ([..])
[ARCHIVING] [..]
[ARCHIVING] [..]
Expand Down Expand Up @@ -391,6 +398,7 @@ fn ignore_nested() {
assert_that(p.cargo_process("package"),
execs().with_status(0).with_stderr(&format!("\
[WARNING] manifest has no documentation[..]
See http://doc.crates.io/manifest.html#package-metadata for more info.
[PACKAGING] nested v0.0.1 ({dir})
[VERIFYING] nested v0.0.1 ({dir})
[COMPILING] nested v0.0.1 ({dir}[..])
Expand Down Expand Up @@ -439,6 +447,7 @@ fn package_weird_characters() {
assert_that(p.cargo_process("package"),
execs().with_status(101).with_stderr("\
warning: [..]
See [..]
[PACKAGING] foo [..]
[ERROR] failed to prepare local package for uploading
Expand Down Expand Up @@ -479,6 +488,7 @@ fn repackage_on_source_change() {
// Check that cargo rebuilds the tarball
assert_that(pro, execs().with_status(0).with_stderr(&format!("\
[WARNING] [..]
See [..]
[PACKAGING] foo v0.0.1 ({dir})
[VERIFYING] foo v0.0.1 ({dir})
[COMPILING] foo v0.0.1 ({dir}[..])
Expand Down
2 changes: 2 additions & 0 deletions tests/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ fn simple() {
execs().with_status(0).with_stderr(&format!("\
[UPDATING] registry `{reg}`
[WARNING] manifest has no documentation, [..]
See [..]
[PACKAGING] foo v0.0.1 ({dir})
[UPLOADING] foo v0.0.1 ({dir})
",
Expand Down Expand Up @@ -357,6 +358,7 @@ fn dry_run() {
execs().with_status(0).with_stderr(&format!("\
[UPDATING] registry `[..]`
[WARNING] manifest has no documentation, [..]
See [..]
[PACKAGING] foo v0.0.1 ({dir})
[VERIFYING] foo v0.0.1 ({dir})
[COMPILING] foo v0.0.1 [..]
Expand Down

0 comments on commit 3227546

Please sign in to comment.