Add unknown short flag test

This commit is contained in:
Fabricio Dematte 2021-05-17 21:56:22 -03:00
parent afbda444ef
commit 1e11a99991

View File

@ -239,6 +239,19 @@ mod tests {
assert!(!flags.is_present("output_file"));
}
#[test]
fn test_unknown_short_flag() {
let flags_info = [
ArgFlag::long("output_file").short('o'),
Flag::long("verbose").short('v'),
Flag::long("help").short('h'),
];
let args = gen_args("ouch a.zip -s b.tar.gz");
let result = filter_flags(args, &flags_info).unwrap_err();
assert!(matches!(result, OofError::UnknownShortFlag('s')));
}
#[test]
fn test_pop_subcommand() {
let subcommands = &["commit", "add", "push", "remote"];