blob: 4adc68582062a66f04f20bafd48d7788b550cf92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
extern crate clap;
extern crate regex;
#[cfg(test)]
mod tests {
include!("../clap-test.rs");
use clap::{App, Arg, SubCommand};
fn get_app() -> App<'static, 'static> {
App::new("myprog")
.arg(Arg::with_name("GLOBAL_ARG")
.long("global-arg")
.help(
"Specifies something needed by the subcommands",
)
.global(true)
.takes_value(true)
.default_value("default_value"))
.arg(Arg::with_name("GLOBAL_FLAG")
.long("global-flag")
.help(
"Specifies something needed by the subcommands",
)
.multiple(true)
.global(true))
.subcommand(SubCommand::with_name("outer")
.subcommand(SubCommand::with_name("inner")))
}
#[test]
fn issue_1076() {
let mut app = get_app();
let _ = app.get_matches_from_safe_borrow(vec!["myprog"]);
let _ = app.get_matches_from_safe_borrow(vec!["myprog"]);
let _ = app.get_matches_from_safe_borrow(vec!["myprog"]);
}
}
|