Skip to content

Commit

Permalink
test(toml): Show values before tables doesnt reproduce
Browse files Browse the repository at this point in the history
With toml-rs#470, we changed our generator which can handle more cases

Fixes toml-rs#403
  • Loading branch information
epage committed Jan 19, 2023
1 parent 6aec42f commit 700008f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions crates/toml/tests/testsuite/tables_last.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,37 @@ fn vec_order_issue_356() {
let s = toml::to_string_pretty(&outer).unwrap();
let _o: Outer = toml::from_str(&s).unwrap();
}

#[test]
fn values_before_tables_issue_403() {
#[derive(Serialize, Deserialize)]
struct A {
a: String,
b: String,
}

#[derive(Serialize, Deserialize)]
struct B {
a: String,
b: Vec<String>,
}

#[derive(Serialize, Deserialize)]
struct C {
a: A,
b: Vec<String>,
c: Vec<B>,
}
toml::to_string(&C {
a: A {
a: "aa".to_string(),
b: "ab".to_string(),
},
b: vec!["b".to_string()],
c: vec![B {
a: "cba".to_string(),
b: vec!["cbb".to_string()],
}],
})
.unwrap();
}

0 comments on commit 700008f

Please sign in to comment.