From a64df78ea6036e489f5eace385faa16dd268aafb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Mar 2018 18:30:24 +0300 Subject: [PATCH] Relax tests for windows On windows, clap prints `cargo.exe` rather than just `cargo`. --- tests/testsuite/build.rs | 8 +------- tests/testsuite/cargo_command.rs | 10 ++-------- tests/testsuite/init.rs | 7 +------ tests/testsuite/metadata.rs | 9 ++------- tests/testsuite/new.rs | 14 ++------------ tests/testsuite/run.rs | 8 ++------ tests/testsuite/rustc.rs | 8 ++------ 7 files changed, 12 insertions(+), 52 deletions(-) diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 615edf2db..2987b9db1 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -3250,15 +3250,9 @@ fn wrong_message_format_option() { assert_that(p.cargo("build").arg("--message-format").arg("XML"), execs().with_status(1) - .with_stderr("\ + .with_stderr_contains("\ error: 'XML' isn't a valid value for '--message-format ' [possible values: human, json] - - -USAGE: - cargo build --message-format - -For more information try --help ")); } diff --git a/tests/testsuite/cargo_command.rs b/tests/testsuite/cargo_command.rs index 7944fbeed..955905c3e 100644 --- a/tests/testsuite/cargo_command.rs +++ b/tests/testsuite/cargo_command.rs @@ -102,16 +102,10 @@ fn find_closest_biuld_to_build() { assert_that(pr, execs().with_status(1) - .with_stderr("\ + .with_stderr_contains("\ error: The subcommand 'biuld' wasn't recognized Did you mean 'build'? - -If you believe you received this message in error, try re-running with 'cargo -- biuld' - -USAGE: - cargo [OPTIONS] [SUBCOMMAND] - -For more information try --help")); +")); } // if a subcommand is more than 3 edit distance away, we don't make a suggestion diff --git a/tests/testsuite/init.rs b/tests/testsuite/init.rs index f80aedf52..8f79ae6b4 100644 --- a/tests/testsuite/init.rs +++ b/tests/testsuite/init.rs @@ -443,13 +443,8 @@ fn with_argument() { fn unknown_flags() { assert_that(cargo_process("init").arg("foo").arg("--flag"), execs().with_status(1) - .with_stderr("\ + .with_stderr_contains("\ error: Found argument '--flag' which wasn't expected, or isn't valid in this context - -USAGE: - cargo init [OPTIONS] [--] [path] - -For more information try --help ")); } diff --git a/tests/testsuite/metadata.rs b/tests/testsuite/metadata.rs index 296e6f3f0..a77116598 100644 --- a/tests/testsuite/metadata.rs +++ b/tests/testsuite/metadata.rs @@ -753,15 +753,10 @@ fn cargo_metadata_bad_version() { .arg("--format-version").arg("2") .cwd(p.root()), execs().with_status(1) - .with_stderr("\ + .with_stderr_contains("\ 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/new.rs b/tests/testsuite/new.rs index ab30b2062..bc5418210 100644 --- a/tests/testsuite/new.rs +++ b/tests/testsuite/new.rs @@ -103,14 +103,9 @@ fn simple_git() { fn no_argument() { assert_that(cargo_process("new"), execs().with_status(1) - .with_stderr("\ + .with_stderr_contains("\ error: The following required arguments were not provided: - -USAGE: - cargo new [OPTIONS] - -For more information try --help ")); } @@ -375,13 +370,8 @@ fn subpackage_git_with_vcs_arg() { fn unknown_flags() { assert_that(cargo_process("new").arg("foo").arg("--flag"), execs().with_status(1) - .with_stderr("\ + .with_stderr_contains("\ error: Found argument '--flag' which wasn't expected, or isn't valid in this context - -USAGE: - cargo new [OPTIONS] - -For more information try --help ")); } diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 0d123d05a..22678ca23 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -809,13 +809,9 @@ fn run_multiple_packages() { assert_that(cargo().arg("-p").arg("d1").arg("-p").arg("d2"), execs() .with_status(1) - .with_stderr("\ + .with_stderr_contains("\ 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 72629f6b3..ab5cb8d7b 100644 --- a/tests/testsuite/rustc.rs +++ b/tests/testsuite/rustc.rs @@ -355,14 +355,10 @@ 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("\ + execs().with_status(1).with_stderr_contains("\ error: The argument '--package ' was provided more than once, \ but cannot be used multiple times - -USAGE: - cargo rustc --message-format --package --verbose - -For more information try --help")); +")); } #[test]