Skip to content

Commit

Permalink
test(multicall): Conditionalize suggestion-related case
Browse files Browse the repository at this point in the history
This impacts the error code (clap-rs#3676) and the error body and without
suggestions, its redundant.
  • Loading branch information
epage committed May 20, 2022
1 parent 17ec775 commit 1a2b7ac
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/builder/subcommands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,11 @@ For more information try help
";
utils::assert_eq(HELLO_EXPECTED, err.to_string());

let err = cmd.clone().try_get_matches_from(&["baz"]).unwrap_err();
assert_eq!(err.kind(), ErrorKind::InvalidSubcommand);
static BAZ_EXPECTED: &str = "\
#[cfg(feature = "suggestions")]
{
let err = cmd.clone().try_get_matches_from(&["baz"]).unwrap_err();
assert_eq!(err.kind(), ErrorKind::InvalidSubcommand);
static BAZ_EXPECTED: &str = "\
error: The subcommand 'baz' wasn't recognized
\tDid you mean 'bar'?
Expand All @@ -586,7 +588,8 @@ USAGE:
For more information try help
";
utils::assert_eq(BAZ_EXPECTED, err.to_string());
utils::assert_eq(BAZ_EXPECTED, err.to_string());
}

// Verify whatever we did to get the above to work didn't disable `--help` and `--version`.

Expand Down

0 comments on commit 1a2b7ac

Please sign in to comment.