Skip to content

Commit

Permalink
Adding test for ron deser
Browse files Browse the repository at this point in the history
  • Loading branch information
mWalrus committed Oct 19, 2022
1 parent 381b3ff commit 511c204
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,22 @@ mod tests {
assert_eq!(buf, message);
Ok(())
}

// Verify that [`load_path`] can deserialize into structs with differing names
// as long as they have the same fields
#[test]
fn test_ron_change_struct_name() -> Result<(), ConfyError> {
with_config_path(|path| {
#[derive(PartialEq, Default, Debug, Serialize, Deserialize)]
struct AnotherExampleConfig {
name: String,
count: usize,
}

store_path(path, &ExampleConfig::default()).expect("store_path failed");
let _: AnotherExampleConfig = load_path(path).expect("load_path failed");
});

Ok(())
}
}

0 comments on commit 511c204

Please sign in to comment.