Skip to content

Commit

Permalink
Merge pull request #462 from epage/test
Browse files Browse the repository at this point in the history
test(serde): Verify #388 was fixed by #457
  • Loading branch information
epage authored Jan 18, 2023
2 parents 44f0eaa + cfff9ae commit 21fdbab
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions crates/toml/tests/testsuite/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,3 +695,27 @@ fn json_interoperability() {
)
.unwrap();
}

#[test]
fn table_type_enum_regression_issue_388() {
#[derive(Deserialize)]
struct DataFile {
#[allow(dead_code)]
data: Compare,
}

#[derive(Deserialize)]
enum Compare {
Gt(u32),
}

let dotted_table = r#"
data.Gt = 5
"#;
assert!(toml::from_str::<DataFile>(dotted_table).is_ok());

let inline_table = r#"
data = { Gt = 5 }
"#;
assert!(toml::from_str::<DataFile>(inline_table).is_ok());
}

0 comments on commit 21fdbab

Please sign in to comment.