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