mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
tests: adds tests to guard against subcommand section of help message showing unnecessarily
This commit is contained in:
parent
4ae7b04647
commit
8567f0a46e
1 changed files with 27 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue