Skip to content

Commit

Permalink
test(error): Show existing last behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 16, 2024
1 parent b48c90f commit 7de6df8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/builder/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,29 @@ For more information, try '--help'.
assert_error(err, expected_kind, MESSAGE, true);
}

#[test]
#[cfg(feature = "error-context")]
fn suggest_trailing_last() {
let cmd = Command::new("cargo")
.arg(arg!([TESTNAME]).last(true))
.arg(arg!(--"ignore-rust-version"));

let res = cmd.try_get_matches_from(["cargo", "--ignored"]);
assert!(res.is_err());
let err = res.unwrap_err();
let expected_kind = ErrorKind::UnknownArgument;
static MESSAGE: &str = "\
error: unexpected argument '--ignored' found
tip: a similar argument exists: '--ignore-rust-version'
Usage: cargo --ignore-rust-version [-- <TESTNAME>]
For more information, try '--help'.
";
assert_error(err, expected_kind, MESSAGE, true);
}

#[test]
#[cfg(feature = "error-context")]
fn trailing_already_in_use() {
Expand Down

0 comments on commit 7de6df8

Please sign in to comment.