mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
Replicate the derive test for from_global
This commit is contained in:
parent
856de610a2
commit
03d4989ef9
1 changed files with 15 additions and 0 deletions
|
@ -82,3 +82,18 @@ fn propagate_global_arg_to_subcommand_in_subsubcommand_2053() {
|
|||
m.subcommand_matches("test").unwrap().value_of("sub-str")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn global_arg_available_in_subcommand() {
|
||||
let m = App::new("opt")
|
||||
.args(&[
|
||||
Arg::new("global").global(true).long("global"),
|
||||
Arg::new("not").global(false).long("not"),
|
||||
])
|
||||
.subcommand(App::new("ping"))
|
||||
.get_matches_from(&["opt", "ping", "--global"]);
|
||||
|
||||
assert!(m.is_present("global"));
|
||||
assert!(m.subcommand_matches("ping").unwrap().is_present("global"));
|
||||
assert!(!m.subcommand_matches("ping").unwrap().is_present("not"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue