2015-08-27 21:03:45 +00:00
|
|
|
extern crate clap;
|
|
|
|
|
|
|
|
use clap::{App, Arg};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[should_panic]
|
|
|
|
fn unique_arg_names() {
|
2018-01-25 02:08:14 +00:00
|
|
|
let _ = App::new("some")
|
|
|
|
.args(&[
|
2018-07-23 19:09:42 +00:00
|
|
|
Arg::with_name("arg").short('a'),
|
|
|
|
Arg::with_name("arg").short('b'),
|
2018-01-25 02:08:14 +00:00
|
|
|
])
|
|
|
|
.get_matches_safe();
|
2015-08-27 21:03:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[should_panic]
|
|
|
|
fn unique_arg_shorts() {
|
2018-01-25 02:08:14 +00:00
|
|
|
let _ = App::new("some")
|
|
|
|
.args(&[
|
2018-07-23 19:09:42 +00:00
|
|
|
Arg::with_name("arg1").short('a'),
|
|
|
|
Arg::with_name("arg2").short('a'),
|
2018-01-25 02:08:14 +00:00
|
|
|
])
|
|
|
|
.get_matches_safe();
|
2015-08-27 21:03:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[should_panic]
|
|
|
|
fn unique_arg_longs() {
|
2018-01-25 02:08:14 +00:00
|
|
|
let _ = App::new("some")
|
|
|
|
.args(&[
|
|
|
|
Arg::with_name("arg1").long("long"),
|
|
|
|
Arg::with_name("arg2").long("long"),
|
|
|
|
])
|
|
|
|
.get_matches_safe();
|
2016-01-21 06:48:30 +00:00
|
|
|
}
|