clap/tests/builder/borrowed.rs
Ed Page 045bf99ae0 test: Consolidate builder tests
This is prep for moving the derive tests.  Besides organizing the test
folder for each API, this should reduce link time at the cost of
re-compiling more when a test changes.
2021-11-30 10:07:05 -06:00

17 lines
488 B
Rust

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')
.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"]);
assert!(result.is_ok());
}