mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 14:22:34 +00:00
test(derive): Show existing flatten behavior
This commit is contained in:
parent
e1bdfcc6ad
commit
4f875ffe20
1 changed files with 19 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue