test(derive): Show existing flatten behavior

This commit is contained in:
Ed Page 2024-07-31 15:10:32 -05:00
parent e1bdfcc6ad
commit 4f875ffe20

View file

@ -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();
}