1 use clap::{Arg, Command}; 2 3 #[test] borrowed_args()4fn borrowed_args() { 5 let arg = Arg::new("some").short('s').long("some").help("other help"); 6 let arg2 = Arg::new("some2") 7 .short('S') 8 .long("some-thing") 9 .help("other help"); 10 let result = Command::new("sub_command_negate") 11 .arg(Arg::new("test").index(1)) 12 .arg(&arg) 13 .arg(&arg2) 14 .subcommand(Command::new("sub1").arg(&arg)) 15 .try_get_matches_from(vec!["prog"]); 16 assert!(result.is_ok(), "{}", result.unwrap_err()); 17 } 18