From 25cbca4e41a9ae41f9f11fd7e2286bc7fd1ce51c Mon Sep 17 00:00:00 2001 From: Kevin K Date: Fri, 30 Dec 2016 22:40:28 -0500 Subject: [PATCH] tests: adds tests for --- tests/app_settings.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/app_settings.rs b/tests/app_settings.rs index 40f92f20..ef4e7972 100644 --- a/tests/app_settings.rs +++ b/tests/app_settings.rs @@ -1,7 +1,24 @@ extern crate clap; +extern crate regex; use clap::{App, Arg, SubCommand, AppSettings, ErrorKind}; +include!("../clap-test.rs"); + +static DONT_COLLAPSE_ARGS: &'static str = "clap-test v1.4.8 + +USAGE: + clap-test [arg1] [arg2] [arg3] + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +ARGS: + some + some + some"; + #[test] fn sub_command_negate_required() { App::new("sub_command_negate") @@ -381,4 +398,17 @@ fn disable_help_subcommand() { assert!(result.is_err()); let err = result.err().unwrap(); assert_eq!(err.kind, ErrorKind::UnknownArgument); +} + +#[test] +fn dont_collapse_args() { + let app = App::new("clap-test") + .version("v1.4.8") + .setting(AppSettings::DontCollapseArgsInUsage) + .args(&[ + Arg::with_name("arg1").help("some"), + Arg::with_name("arg2").help("some"), + Arg::with_name("arg3").help("some"), + ]); + test::check_help(app, DONT_COLLAPSE_ARGS); } \ No newline at end of file