clap/tests/unique_args.rs
Kevin K 0efa411963
perf: refactor to remove unneeded vectors and allocations and checks for significant performance increases
Building an `App` struct with a fair number of args/flags/switches, etc. (used ripgrep as test case)
went from taking ~21,000 ns to ~13,000ns.
2017-02-28 08:30:13 -05:00

22 lines
507 B
Rust

extern crate clap;
use clap::{App, Arg};
#[test]
#[should_panic]
fn unique_arg_names() {
App::new("some").args(&[Arg::with_name("arg").short("a"), Arg::with_name("arg").short("b")]);
}
#[test]
#[should_panic]
fn unique_arg_shorts() {
App::new("some").args(&[Arg::with_name("arg1").short("a"), Arg::with_name("arg2").short("a")]);
}
#[test]
#[should_panic]
fn unique_arg_longs() {
App::new("some")
.args(&[Arg::with_name("arg1").long("long"), Arg::with_name("arg2").long("long")]);
}