Skip to content

Commit

Permalink
create a failing test for #26
Browse files Browse the repository at this point in the history
  • Loading branch information
softprops committed Apr 13, 2019
1 parent c994621 commit 35050a7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,35 @@ mod tests {
newtype: CustomNewType,
}

#[derive(Deserialize, Debug, PartialEq)]
struct Config {
#[serde(flatten)]
pub subconfig: Subconfig,
}

#[derive(Deserialize, Debug, PartialEq)]
struct Subconfig {
pub size: usize,
}

#[test]
fn deserialize_flatten_from_iter() {
let data = vec![
(String::from("SIZE"), String::from("1"))
];
match from_iter::<_, Config>(data) {
Ok(config) => assert_eq!(
config,
Config {
subconfig: Subconfig {
size: 1
}
}
),
Err(e) => panic!("{:#?}", e),
}
}

#[test]
fn deserialize_from_iter() {
let data = vec![
Expand Down

0 comments on commit 35050a7

Please sign in to comment.