On windows, clap prints `cargo.exe` rather than just `cargo`.
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 <FMT>'
<tab>[possible values: human, json]
-
-
-USAGE:
- cargo build --message-format <FMT>
-
-For more information try --help
"));
}
assert_that(pr,
execs().with_status(1)
- .with_stderr("\
+ .with_stderr_contains("\
error: The subcommand 'biuld' wasn't recognized
<tab>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
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
"));
}
.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 <VERSION>'
<tab>[possible values: 1]
-
-
-USAGE:
- cargo metadata --format-version <VERSION> --no-deps
-
-For more information try --help"));
+"));
}
#[test]
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:
<path>
-
-USAGE:
- cargo new [OPTIONS] <path>
-
-For more information try --help
"));
}
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] <path>
-
-For more information try --help
"));
}
assert_that(cargo().arg("-p").arg("d1").arg("-p").arg("d2"),
execs()
.with_status(1)
- .with_stderr("\
+ .with_stderr_contains("\
error: The argument '--package <SPEC>' was provided more than once, but cannot be used multiple times
-
-USAGE:
- cargo run --message-format <FMT> --package <SPEC>
-
-For more information try --help"));
+"));
assert_that(cargo().arg("-p").arg("d3"),
execs()
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 <SPEC>' was provided more than once, \
but cannot be used multiple times
-
-USAGE:
- cargo rustc --message-format <FMT> --package <SPEC> --verbose
-
-For more information try --help"));
+"));
}
#[test]