clap/tests/builder/borrowed.rs

18 lines
515 B
Rust
Raw Normal View History

2018-11-14 17:05:06 +00:00
use clap::{App, Arg};
#[test]
fn borrowed_args() {
let arg = Arg::new("some").short('s').long("some").help("other help");
let arg2 = Arg::new("some2")
.short('S')
2018-01-25 04:05:05 +00:00
.long("some-thing")
.help("other help");
let result = App::new("sub_command_negate")
.arg(Arg::new("test").index(1))
.arg(&arg)
.arg(&arg2)
.subcommand(App::new("sub1").arg(&arg))
.try_get_matches_from(vec!["prog"]);
2021-12-27 19:57:38 +00:00
assert!(result.is_ok(), "{}", result.unwrap_err());
}