diff options
author | tyranron <tyranron@gmail.com> | 2019-04-08 15:33:14 +0300 |
---|---|---|
committer | tyranron <tyranron@gmail.com> | 2019-04-08 15:33:14 +0300 |
commit | 37403d00d2dcd8c5ceca4ab7f40ef704c6df32d8 (patch) | |
tree | ca15283bab01cf4f0ea6113b38f4585b69ee6a32 /tests | |
parent | 9b0aa7362c21b01376739a013126a9db3ce355bc (diff) |
Fix annoying 'invalid type: unit value, expected struct Settings' error
Diffstat (limited to 'tests')
-rw-r--r-- | tests/empty.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/empty.rs b/tests/empty.rs new file mode 100644 index 0000000..1f56d38 --- /dev/null +++ b/tests/empty.rs @@ -0,0 +1,21 @@ +extern crate config; + +#[macro_use] +extern crate serde_derive; + +use config::*; + +#[derive(Debug, Serialize, Deserialize)] +struct Settings { + #[serde(skip)] + foo: isize, + #[serde(skip)] + bar: u8, +} + +#[test] +fn empty_deserializes() { + let s: Settings = Config::new().try_into().expect("Deserialization failed"); + assert_eq!(s.foo, 0); + assert_eq!(s.bar, 0); +} |