2018-11-14 17:05:06 +00:00
|
|
|
use clap::{App, Arg};
|
2017-02-28 04:36:11 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn borrowed_args() {
|
2021-11-18 16:17:15 +00:00
|
|
|
let arg = Arg::new("some").short('s').long("some").help("other help");
|
2020-05-14 20:50:56 +00:00
|
|
|
let arg2 = Arg::new("some2")
|
2018-07-23 19:09:42 +00:00
|
|
|
.short('S')
|
2018-01-25 04:05:05 +00:00
|
|
|
.long("some-thing")
|
2021-11-18 16:17:15 +00:00
|
|
|
.help("other help");
|
2017-02-28 04:36:11 +00:00
|
|
|
let result = App::new("sub_command_negate")
|
2020-05-14 20:50:56 +00:00
|
|
|
.arg(Arg::new("test").index(1))
|
2017-02-28 04:36:11 +00:00
|
|
|
.arg(&arg)
|
|
|
|
.arg(&arg2)
|
2018-10-19 20:42:13 +00:00
|
|
|
.subcommand(App::new("sub1").arg(&arg))
|
|
|
|
.try_get_matches_from(vec!["prog"]);
|
2017-02-28 04:36:11 +00:00
|
|
|
assert!(result.is_ok());
|
|
|
|
}
|