tests: adds tests to guard against subcommand section of help message showing unnecessarily

This commit is contained in:
Kevin K 2017-09-14 10:37:13 -07:00
parent 4ae7b04647
commit 8567f0a46e
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A

View file

@ -124,6 +124,22 @@ OPTIONS:
ARGS:
<scpositional> tests positionals";
static ISSUE_1046_HIDDEN_SCS: &'static str = "prog 1.0
USAGE:
prog [FLAGS] [OPTIONS] [PATH]
FLAGS:
-f, --flag testing flags
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-o, --opt <FILE> tests options
ARGS:
<PATH> some";
// Using number_of_values(1) with multiple(true) misaligns help message
static ISSUE_760: &'static str = "ctest 0.1
@ -899,6 +915,17 @@ fn args_negate_sc() {
assert!(test::compare_output(app, "prog --help", ARGS_NEGATE_SC, false));
}
#[test]
fn issue_1046_hidden_scs() {
let app = App::new("prog")
.version("1.0")
.args_from_usage("-f, --flag 'testing flags'
-o, --opt [FILE] 'tests options'")
.arg(Arg::with_name("PATH").help("some"))
.subcommand(SubCommand::with_name("test").setting(AppSettings::Hidden));
assert!(test::compare_output(app, "prog --help", ISSUE_1046_HIDDEN_SCS, false));
}
#[test]
fn issue_777_wrap_all_things() {
let app = App::new("A app with a crazy very long long long name hahaha")