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 4, 2022
1 parent efd2253 commit c7876a2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/builder/subcommands.rs
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 c7876a2

Please sign in to comment.