Skip to content

Commit

Permalink
test(derive): Show existing flatten behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 31, 2024
1 parent e1bdfcc commit 4f875ff
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/derive/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,22 @@ fn docstrings_ordering_with_multiple_clap_partial() {

assert!(short_help.contains("This is the docstring for Flattened"));
}

#[test]
#[should_panic = "#[arg(flatten)]`ed field type implements `Args::group_id"]
fn flatten_skipped_group() {
#[derive(clap::Parser, Debug)]
struct Cli {
#[clap(flatten)]
args: Option<Args>,
}

#[derive(clap::Args, Debug)]
#[group(skip)]
struct Args {
#[clap(short)]
param: bool,
}

Cli::try_parse_from(["test"]).unwrap();
}

0 comments on commit 4f875ff

Please sign in to comment.