tests(DisableHelpSubcommand): adds tests for AppSettings::DisableHelpSubcommand

This commit is contained in:
Kevin K 2016-12-30 21:53:58 -05:00
parent a10fc859ee
commit 01caf84b87
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A

View file

@ -371,3 +371,14 @@ fn test_unset_settings() {
assert!(!m.p.is_set(AppSettings::AllowInvalidUtf8));
assert!(!m.p.is_set(AppSettings::ColorAuto));
}
#[test]
fn disable_help_subcommand() {
let result = App::new("disablehelp")
.setting(AppSettings::DisableHelpSubcommand)
.subcommand(SubCommand::with_name("sub1"))
.get_matches_from_safe(vec!["", "help"]);
assert!(result.is_err());
let err = result.err().unwrap();
assert_eq!(err.kind, ErrorKind::UnknownArgument);
}