From 65f57b2067920f25bf6c13c64123166c9dfccb20 Mon Sep 17 00:00:00 2001 From: Mingun Date: Fri, 22 Nov 2024 23:08:58 +0500 Subject: [PATCH] Remove ignored tests which produces warnings since serde 1.0.215 They are never will be implemented anyway. You need to implement deserialization manually if you want two xs:choice fields in your struct. --- tests/serde-de-seq.rs | 182 +++++++----------------------------------- 1 file changed, 28 insertions(+), 154 deletions(-) diff --git a/tests/serde-de-seq.rs b/tests/serde-de-seq.rs index 4ffa4105..a1aaa6dc 100644 --- a/tests/serde-de-seq.rs +++ b/tests/serde-de-seq.rs @@ -2792,83 +2792,20 @@ mod variable_name { } } - /// Tests are ignored, but exists to show a problem. - /// May be it will be solved in the future - mod choice_and_choice { - use super::*; - use pretty_assertions::assert_eq; - - #[derive(Debug, PartialEq, Deserialize)] - struct Pair { - #[serde(rename = "$value")] - item: [Choice; 3], - // Actually, we cannot rename both fields to `$value`, which is now - // required to indicate, that field accepts elements with any name - #[serde(rename = "$value")] - element: [Choice2; 2], - } - - #[test] - #[ignore = "There is no way to associate XML elements with `item` or `element` without extra knowledge from type"] - fn splitted() { - let data: Pair = from_str( - r#" - - - - - - - - "#, - ) - .unwrap(); - - assert_eq!( - data, - Pair { - item: [Choice::One, Choice::Two, Choice::Other("three".into())], - element: [Choice2::First, Choice2::Second], - } - ); - } - - #[test] - #[ignore = "There is no way to associate XML elements with `item` or `element` without extra knowledge from type"] - fn overlapped() { - let data = from_str::( - r#" - - - - - - - - "#, - ); - - #[cfg(feature = "overlapped-lists")] - assert_eq!( - data.unwrap(), - Pair { - item: [Choice::One, Choice::Two, Choice::Other("three".into())], - element: [Choice2::First, Choice2::Second], - } - ); - - #[cfg(not(feature = "overlapped-lists"))] - match data { - Err(DeError::Custom(e)) => { - assert_eq!(e, "invalid length 1, expected an array of length 3") - } - e => panic!( - r#"Expected `Err(Custom("invalid length 1, expected an array of length 3"))`, but got `{:?}`"#, - e - ), - } - } - } + // choice_and_choice struct like + // + // #[derive(Deserialize)] + // struct Pair { + // #[serde(rename = "$value")] + // item: [Choice; 2], + // + // #[serde(rename = "$value")] + // element: [Choice2; 3], + // } + // + // cannot be implemented because both fields should be renamed to the + // same name $value. Derived implementation will never try to deserialize + // `element` } /// Deserialization of primitives slightly differs from deserialization @@ -3932,83 +3869,20 @@ mod variable_name { } } - /// Tests are ignored, but exists to show a problem. - /// May be it will be solved in the future - mod choice_and_choice { - use super::*; - use pretty_assertions::assert_eq; - - #[derive(Debug, PartialEq, Deserialize)] - struct Pair { - #[serde(rename = "$value")] - item: Vec, - // Actually, we cannot rename both fields to `$value`, which is now - // required to indicate, that field accepts elements with any name - #[serde(rename = "$value")] - element: Vec, - } - - #[test] - #[ignore = "There is no way to associate XML elements with `item` or `element` without extra knowledge from type"] - fn splitted() { - let data: Pair = from_str( - r#" - - - - - - - - "#, - ) - .unwrap(); - - assert_eq!( - data, - Pair { - item: vec![Choice::One, Choice::Two, Choice::Other("three".into())], - element: vec![Choice2::First, Choice2::Second], - } - ); - } - - #[test] - #[ignore = "There is no way to associate XML elements with `item` or `element` without extra knowledge from type"] - fn overlapped() { - let data = from_str::( - r#" - - - - - - - - "#, - ); - - #[cfg(feature = "overlapped-lists")] - assert_eq!( - data.unwrap(), - Pair { - item: vec![Choice::One, Choice::Two, Choice::Other("three".into())], - element: vec![Choice2::First, Choice2::Second], - } - ); - - #[cfg(not(feature = "overlapped-lists"))] - match data { - Err(DeError::Custom(e)) => { - assert_eq!(e, "invalid length 1, expected an array of length 3") - } - e => panic!( - r#"Expected `Err(Custom("invalid length 1, expected an array of length 3"))`, but got `{:?}`"#, - e - ), - } - } - } + // choice_and_choice struct like + // + // #[derive(Deserialize)] + // struct Pair { + // #[serde(rename = "$value")] + // item: Vec, + // + // #[serde(rename = "$value")] + // element: Vec, + // } + // + // cannot be implemented because both fields should be renamed to the + // same name $value. Derived implementation will never try to deserialize + // `element` } /// Deserialization of primitives slightly differs from deserialization