1#[cfg(debug_assertions)] 2#[test] 3#[should_panic = "Argument names must be unique, but 'arg1' is in use by more than one argument or group"] 4fn unique_arg_names() { 5 use clap::{Arg, Command}; 6 7 let _ = Command::new("some") 8 .args([Arg::new("arg1").short('a'), Arg::new("arg1").short('b')]) 9 .try_get_matches(); 10} 11 12#[cfg(debug_assertions)] 13#[test] 14#[should_panic = "Short option names must be unique for each argument, but '-a' is in use by both 'arg1' and 'arg2'"] 15fn unique_arg_shorts() { 16 use clap::{Arg, Command}; 17 18 let _ = Command::new("some") 19 .args([Arg::new("arg1").short('a'), Arg::new("arg2").short('a')]) 20 .try_get_matches(); 21} 22 23#[cfg(debug_assertions)] 24#[test] 25#[should_panic = "Long option names must be unique for each argument, but '--long' is in use by both 'arg1' and 'arg2'"] 26fn unique_arg_longs() { 27 use clap::{Arg, Command}; 28 29 let _ = Command::new("some") 30 .args([Arg::new("arg1").long("long"), Arg::new("arg2").long("long")]) 31 .try_get_matches(); 32} 33