mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
Replicate diesel's issue with failing nested subcommand
This commit is contained in:
parent
6f3b454573
commit
12a7310233
1 changed files with 9 additions and 3 deletions
|
@ -69,12 +69,18 @@ fn subcommand_can_access_global_arg_if_setting_is_on() {
|
|||
.arg(global_arg)
|
||||
.subcommand(double_sub_command)
|
||||
.get_matches_from(
|
||||
vec!["globals", "outer", "--global-arg", "some_value"]
|
||||
vec!["globals", "outer", "run", "--global-arg", "some_value"]
|
||||
);
|
||||
|
||||
let sub_match = matches.subcommand_matches("outer").expect("could not access subcommand");
|
||||
|
||||
assert_eq!(sub_match.value_of("global-arg").expect("subcommand could not access global arg"),
|
||||
assert_eq!(sub_match.value_of("GLOBAL_ARG").expect("subcommand could not access global arg"),
|
||||
"some_value", "subcommand did not have expected value for global arg");
|
||||
|
||||
}
|
||||
let sub_sub_match = sub_match.subcommand_matches("run").expect("could not access inner sub");
|
||||
|
||||
assert_eq!(sub_sub_match.value_of("GLOBAL_ARG").expect("subcommand could not access global arg"),
|
||||
"some_value", "inner subcommand did not have expected value for global arg");
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue