xref: /third_party/rust/crates/clap/tests/builder/borrowed.rs
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/rust/crates/clap/tests/builder/
119625d8cSopenharmony_ciuse clap::{Arg, Command};
219625d8cSopenharmony_ci
319625d8cSopenharmony_ci#[test]
419625d8cSopenharmony_cifn borrowed_args() {
519625d8cSopenharmony_ci    let arg = Arg::new("some").short('s').long("some").help("other help");
619625d8cSopenharmony_ci    let arg2 = Arg::new("some2")
719625d8cSopenharmony_ci        .short('S')
819625d8cSopenharmony_ci        .long("some-thing")
919625d8cSopenharmony_ci        .help("other help");
1019625d8cSopenharmony_ci    let result = Command::new("sub_command_negate")
1119625d8cSopenharmony_ci        .arg(Arg::new("test").index(1))
1219625d8cSopenharmony_ci        .arg(&arg)
1319625d8cSopenharmony_ci        .arg(&arg2)
1419625d8cSopenharmony_ci        .subcommand(Command::new("sub1").arg(&arg))
1519625d8cSopenharmony_ci        .try_get_matches_from(vec!["prog"]);
1619625d8cSopenharmony_ci    assert!(result.is_ok(), "{}", result.unwrap_err());
1719625d8cSopenharmony_ci}
18

Indexes created Thu Nov 07 10:32:03 CST 2024