Replicate diesel's issue with failing nested subcommand

This commit is contained in:
Will Murphy 2017-10-01 12:35:30 -04:00
parent 6f3b454573
commit 12a7310233

View file

@ -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");
}