Skip to content

Commit

Permalink
Refactor FromMeta enum tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsemakula committed Jan 3, 2024
1 parent 3a5a633 commit 778b58b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/from_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ mod enum_impl {
Decibels(u8),
}

#[test]
fn string_for_unit_variant() {
let volume = Volume::from_string("low").unwrap();
assert_eq!(volume, Volume::Low);
}

#[test]
fn single_value_list() {
let unit_variant = Volume::from_list(&[parse_quote!(high)]).unwrap();
Expand All @@ -90,9 +96,9 @@ mod enum_impl {
}

#[test]
fn string_for_unit_variant() {
let volume = Volume::from_string("low").unwrap();
assert_eq!(volume, Volume::Low);
fn empty_list_errors() {
let err = Volume::from_list(&[]).unwrap_err();
assert_eq!(err.to_string(), Error::too_few_items(1).to_string());
}

#[test]
Expand Down

0 comments on commit 778b58b

Please sign in to comment.