Graceful exit when invalid CLI flags are passed (#6485)
This commit is contained in:
@@ -1201,6 +1201,7 @@ mod tests {
|
||||
Snapshots, VM, Misc, Whisper, SecretStore,
|
||||
};
|
||||
use toml;
|
||||
use clap::{ErrorKind as ClapErrorKind};
|
||||
|
||||
#[test]
|
||||
fn should_parse_args_and_flags() {
|
||||
@@ -1217,6 +1218,17 @@ mod tests {
|
||||
assert_eq!(args.arg_export_state_min_balance, Some("123".to_string()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_exit_gracefully_on_unknown_argument() {
|
||||
let result = Args::parse(&["parity", "--please-exit-gracefully"]);
|
||||
assert!(
|
||||
match result {
|
||||
Err(ArgsError::Clap(ref clap_error)) if clap_error.kind == ClapErrorKind::UnknownArgument => true,
|
||||
_ => false
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_use_subcommand_arg_default() {
|
||||
let args = Args::parse(&["parity", "export", "state", "--at", "123"]).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user