clap/tests/derive/raw_idents.rs
Ed Page b190a6a817 test: Consolidate clap tests
This reduces the need for us to have `clap` as a dependency in
`clap_derive`, preparing the way to fix #15.
2021-11-30 10:07:08 -06:00

24 lines
459 B
Rust

use clap::Parser;
#[test]
fn raw_idents() {
#[derive(Parser, Debug, PartialEq)]
struct Opt {
#[clap(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()
);
}