Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
frozenlib committed Jul 28, 2024
1 parent 1b5f31a commit 5a13cb8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions parse-display/tests/from_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ fn from_str_struct_field_regex_self() {
assert_from_str("---12---,50", TestStruct { a: 12, b: 50 });
}

#[test]
fn from_str_struct_field_regex_self_and_display() {
#[derive(FromStr, Debug, Eq, PartialEq)]
#[display("{a},{b}")]
struct TestStruct {
#[display("---{}---")]
#[from_str(regex = "---(?P<>[0-9]+)---")]
a: u32,
b: u32,
}
assert_from_str("---12---,50", TestStruct { a: 12, b: 50 });
}

#[test]
fn from_str_struct_format_chain() {
#[derive(FromStr, Debug, Eq, PartialEq, Default)]
Expand Down

0 comments on commit 5a13cb8

Please sign in to comment.