Skip to content

Commit

Permalink
refactor(derive): Divide rename_all assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed May 6, 2022
1 parent ddc9d54 commit f7e4dd2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/derive/naming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ fn test_rename_all_is_not_propagated_from_struct_into_subcommand() {
}

#[test]
fn test_rename_all_is_propagated_from_enum_to_variants_and_their_fields() {
fn test_rename_all_is_propagated_from_enum_to_variants() {
#[derive(Parser, Debug, PartialEq)]
#[clap(rename_all = "screaming_snake")]
enum Opt {
Expand All @@ -304,6 +304,19 @@ fn test_rename_all_is_propagated_from_enum_to_variants_and_their_fields() {
Opt::FirstVariant,
Opt::try_parse_from(&["test", "FIRST_VARIANT"]).unwrap()
);
}

#[test]
fn test_rename_all_is_propagated_from_enum_to_variant_fields() {
#[derive(Parser, Debug, PartialEq)]
#[clap(rename_all = "screaming_snake")]
enum Opt {
FirstVariant,
SecondVariant {
#[clap(long)]
foo: bool,
},
}

assert_eq!(
Opt::SecondVariant { foo: true },
Expand Down

0 comments on commit f7e4dd2

Please sign in to comment.