1 use crate::utils;
2
3 use clap::Parser;
4
5 #[test]
explicit_short_long_no_rename()6 fn explicit_short_long_no_rename() {
7 #[derive(Parser, PartialEq, Debug)]
8 struct Opt {
9 #[arg(short = '.', long = ".foo")]
10 foo: String,
11 }
12
13 assert_eq!(
14 Opt { foo: "long".into() },
15 Opt::try_parse_from(["test", "--.foo", "long"]).unwrap()
16 );
17
18 assert_eq!(
19 Opt {
20 foo: "short".into(),
21 },
22 Opt::try_parse_from(["test", "-.", "short"]).unwrap()
23 );
24 }
25
26 #[test]
explicit_name_no_rename()27 fn explicit_name_no_rename() {
28 #[derive(Parser, PartialEq, Debug)]
29 struct Opt {
30 #[arg(id = ".options")]
31 foo: String,
32 }
33
34 let help = utils::get_long_help::<Opt>();
35 assert!(help.contains("<.options>"))
36 }
37