From 01caf84b871667d1540a42ffa955671bbd9607bc Mon Sep 17 00:00:00 2001 From: Kevin K Date: Fri, 30 Dec 2016 21:53:58 -0500 Subject: [PATCH] tests(DisableHelpSubcommand): adds tests for AppSettings::DisableHelpSubcommand --- tests/app_settings.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/app_settings.rs b/tests/app_settings.rs index 00778904..40f92f20 100644 --- a/tests/app_settings.rs +++ b/tests/app_settings.rs @@ -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); +} \ No newline at end of file