blob: 3847dc2f5c073588fa6a9bc98be93a9b4247e5e3 [file] [log] [blame]
Chih-Hung Hsiehbe338a12020-10-26 13:16:51 -07001use structopt::StructOpt;
2
3mod utils;
4use utils::*;
5
6#[test]
7fn invisible_group_issue_439() {
8 macro_rules! m {
9 ($bool:ty) => {
10 #[derive(Debug, StructOpt)]
11 struct Opts {
12 #[structopt(long = "x")]
13 x: $bool,
14 }
15 };
16 }
17
18 m!(bool);
19
20 let help = get_long_help::<Opts>();
21
22 assert!(help.contains("--x"));
23 assert!(!help.contains("--x <x>"));
24 Opts::from_iter_safe(&["test", "--x"]).unwrap();
25}
Haibo Huang1fc28252020-11-30 18:19:43 -080026
27#[test]
28fn issue_447() {
29 macro_rules! Command {
30 ( $name:ident, [
31 #[$meta:meta] $var:ident($inner:ty)
32 ] ) => {
33 #[derive(Debug, PartialEq, structopt::StructOpt)]
34 enum $name {
35 #[$meta]
36 $var($inner),
37 }
38 };
39 }
40
41 Command! {GitCmd, [
42 #[structopt(external_subcommand)]
43 Ext(Vec<String>)
44 ]}
45}