From f4f8b411f511144d81c7f691ce490adcb62446f6 Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 6 Jul 2017 14:10:41 +0200 Subject: [PATCH] fixed parity tests with new serde and toml --- parity/cli/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index 2b678659c..0b4e4b1d0 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -382,6 +382,7 @@ usage! { #[derive(Default, Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] struct Config { parity: Option, account: Option, @@ -647,7 +648,7 @@ mod tests { #[test] fn should_parse_full_config() { // given - let config = toml::decode_str(include_str!("./config.full.toml")).unwrap(); + let config = toml::from_str(include_str!("./config.full.toml")).unwrap(); // when let args = Args::parse_with_config(&["parity", "--chain", "xyz"], config).unwrap(); @@ -897,7 +898,7 @@ mod tests { let config3 = Args::parse_config(include_str!("./config.invalid3.toml")); match (config1, config2, config3) { - (Err(ArgsError::Parsing(_)), Err(ArgsError::Decode(_)), Err(ArgsError::UnknownFields(_))) => {}, + (Err(ArgsError::Decode(_)), Err(ArgsError::Decode(_)), Err(ArgsError::Decode(_))) => {}, (a, b, c) => { assert!(false, "Got invalid error types: {:?}, {:?}, {:?}", a, b, c); } @@ -906,7 +907,7 @@ mod tests { #[test] fn should_deserialize_toml_file() { - let config: Config = toml::decode_str(include_str!("./config.toml")).unwrap(); + let config: Config = toml::from_str(include_str!("./config.toml")).unwrap(); assert_eq!(config, Config { parity: Some(Operating {