mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
25 lines
603 B
Rust
25 lines
603 B
Rust
extern crate clap;
|
|
extern crate regex;
|
|
|
|
use clap::{App, Arg};
|
|
|
|
include!("../clap-test.rs");
|
|
|
|
#[test]
|
|
fn borrowed_args() {
|
|
let arg = Arg::with_name("some")
|
|
.short('s')
|
|
.long("some")
|
|
.help("other help");
|
|
let arg2 = Arg::with_name("some2")
|
|
.short('S')
|
|
.long("some-thing")
|
|
.help("other help");
|
|
let result = App::new("sub_command_negate")
|
|
.arg(Arg::with_name("test").index(1))
|
|
.arg(&arg)
|
|
.arg(&arg2)
|
|
.subcommand(App::new("sub1").arg(&arg))
|
|
.try_get_matches_from(vec!["prog"]);
|
|
assert!(result.is_ok());
|
|
}
|