mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
24 lines
456 B
Rust
24 lines
456 B
Rust
use clap::Parser;
|
|
|
|
#[test]
|
|
fn raw_idents() {
|
|
#[derive(Parser, Debug, PartialEq)]
|
|
struct Opt {
|
|
#[arg(short, long)]
|
|
r#type: String,
|
|
}
|
|
|
|
assert_eq!(
|
|
Opt {
|
|
r#type: "long".into()
|
|
},
|
|
Opt::try_parse_from(["test", "--type", "long"]).unwrap()
|
|
);
|
|
|
|
assert_eq!(
|
|
Opt {
|
|
r#type: "short".into()
|
|
},
|
|
Opt::try_parse_from(["test", "-t", "short"]).unwrap()
|
|
);
|
|
}
|