From: Aleksey Kladov Date: Thu, 8 Mar 2018 18:55:12 +0000 (+0300) Subject: Use exit code 1 for command line parsing errors X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~47^2~37 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4d3ca9215092d85ed591bf971b1b9b5f01d84c70;p=cargo.git Use exit code 1 for command line parsing errors Note that while we use 101 in majority of cases, sometimes we use 1 as well. --- diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index a569d8c5a..f95c36a05 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -986,14 +986,14 @@ fn version_too() { } #[test] -#[ignore] fn not_both_vers_and_version() { pkg("foo", "0.1.1"); pkg("foo", "0.1.2"); assert_that(cargo_process("install").arg("foo").arg("--version").arg("0.1.1").arg("--vers").arg("0.1.2"), - execs().with_status(101).with_stderr_contains("\ -error: invalid arguments + execs().with_status(1).with_stderr_contains("\ +error: The argument '--version ' was provided more than once, \ +but cannot be used multiple times ")); } diff --git a/tests/testsuite/metadata.rs b/tests/testsuite/metadata.rs index 38e04171d..296e6f3f0 100644 --- a/tests/testsuite/metadata.rs +++ b/tests/testsuite/metadata.rs @@ -743,7 +743,6 @@ fn cargo_metadata_no_deps_cwd() { } #[test] -#[ignore] fn cargo_metadata_bad_version() { let p = project("foo") .file("Cargo.toml", &basic_bin_manifest("foo")) @@ -753,8 +752,16 @@ fn cargo_metadata_bad_version() { assert_that(p.cargo("metadata").arg("--no-deps") .arg("--format-version").arg("2") .cwd(p.root()), - execs().with_status(101) - .with_stderr("[ERROR] metadata version 2 not supported, only 1 is currently supported")); + execs().with_status(1) + .with_stderr("\ +error: '2' isn't a valid value for '--format-version ' +[possible values: 1] + + +USAGE: + cargo metadata --format-version --no-deps + +For more information try --help")); } #[test] diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index d388ebf51..6717b5703 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -743,7 +743,6 @@ fn fail_no_extra_verbose() { } #[test] -#[ignore] fn run_multiple_packages() { let p = project("foo") .file("foo/Cargo.toml", r#" @@ -811,7 +810,13 @@ fn run_multiple_packages() { assert_that(cargo().arg("-p").arg("d1").arg("-p").arg("d2"), execs() .with_status(1) - .with_stderr_contains("[ERROR] Invalid arguments.")); + .with_stderr("\ +error: The argument '--package ' was provided more than once, but cannot be used multiple times + +USAGE: + cargo run --message-format --package + +For more information try --help")); assert_that(cargo().arg("-p").arg("d3"), execs() diff --git a/tests/testsuite/rustc.rs b/tests/testsuite/rustc.rs index 445341d7b..72629f6b3 100644 --- a/tests/testsuite/rustc.rs +++ b/tests/testsuite/rustc.rs @@ -306,7 +306,6 @@ fn build_only_bar_dependency() { } #[test] -#[ignore] fn fail_with_multiple_packages() { let foo = project("foo") .file("Cargo.toml", r#" @@ -357,10 +356,13 @@ fn fail_with_multiple_packages() { assert_that(foo.cargo("rustc").arg("-v").arg("-p").arg("bar") .arg("-p").arg("baz"), execs().with_status(1).with_stderr("\ -[ERROR] Invalid arguments. +error: The argument '--package ' was provided more than once, \ + but cannot be used multiple times -Usage: - cargo rustc [options] [--] [...]")); +USAGE: + cargo rustc --message-format --package --verbose + +For more information try --help")); } #[test]