Skip to content

Commit 0793d6a

Browse files
authored
Merge pull request #833 from Mingun/fix-serde-warnings
Remove ignored tests which produces warnings since serde 1.0.215
2 parents 10177b1 + 65f57b2 commit 0793d6a

File tree

1 file changed

+28
-154
lines changed

1 file changed

+28
-154
lines changed

tests/serde-de-seq.rs

+28-154
Original file line numberDiff line numberDiff line change
@@ -2792,83 +2792,20 @@ mod variable_name {
27922792
}
27932793
}
27942794

2795-
/// Tests are ignored, but exists to show a problem.
2796-
/// May be it will be solved in the future
2797-
mod choice_and_choice {
2798-
use super::*;
2799-
use pretty_assertions::assert_eq;
2800-
2801-
#[derive(Debug, PartialEq, Deserialize)]
2802-
struct Pair {
2803-
#[serde(rename = "$value")]
2804-
item: [Choice; 3],
2805-
// Actually, we cannot rename both fields to `$value`, which is now
2806-
// required to indicate, that field accepts elements with any name
2807-
#[serde(rename = "$value")]
2808-
element: [Choice2; 2],
2809-
}
2810-
2811-
#[test]
2812-
#[ignore = "There is no way to associate XML elements with `item` or `element` without extra knowledge from type"]
2813-
fn splitted() {
2814-
let data: Pair = from_str(
2815-
r#"
2816-
<root>
2817-
<first/>
2818-
<second/>
2819-
<one/>
2820-
<two/>
2821-
<three/>
2822-
</root>
2823-
"#,
2824-
)
2825-
.unwrap();
2826-
2827-
assert_eq!(
2828-
data,
2829-
Pair {
2830-
item: [Choice::One, Choice::Two, Choice::Other("three".into())],
2831-
element: [Choice2::First, Choice2::Second],
2832-
}
2833-
);
2834-
}
2835-
2836-
#[test]
2837-
#[ignore = "There is no way to associate XML elements with `item` or `element` without extra knowledge from type"]
2838-
fn overlapped() {
2839-
let data = from_str::<Pair>(
2840-
r#"
2841-
<root>
2842-
<one/>
2843-
<first/>
2844-
<two/>
2845-
<second/>
2846-
<three/>
2847-
</root>
2848-
"#,
2849-
);
2850-
2851-
#[cfg(feature = "overlapped-lists")]
2852-
assert_eq!(
2853-
data.unwrap(),
2854-
Pair {
2855-
item: [Choice::One, Choice::Two, Choice::Other("three".into())],
2856-
element: [Choice2::First, Choice2::Second],
2857-
}
2858-
);
2859-
2860-
#[cfg(not(feature = "overlapped-lists"))]
2861-
match data {
2862-
Err(DeError::Custom(e)) => {
2863-
assert_eq!(e, "invalid length 1, expected an array of length 3")
2864-
}
2865-
e => panic!(
2866-
r#"Expected `Err(Custom("invalid length 1, expected an array of length 3"))`, but got `{:?}`"#,
2867-
e
2868-
),
2869-
}
2870-
}
2871-
}
2795+
// choice_and_choice struct like
2796+
//
2797+
// #[derive(Deserialize)]
2798+
// struct Pair {
2799+
// #[serde(rename = "$value")]
2800+
// item: [Choice; 2],
2801+
//
2802+
// #[serde(rename = "$value")]
2803+
// element: [Choice2; 3],
2804+
// }
2805+
//
2806+
// cannot be implemented because both fields should be renamed to the
2807+
// same name $value. Derived implementation will never try to deserialize
2808+
// `element`
28722809
}
28732810

28742811
/// Deserialization of primitives slightly differs from deserialization
@@ -3932,83 +3869,20 @@ mod variable_name {
39323869
}
39333870
}
39343871

3935-
/// Tests are ignored, but exists to show a problem.
3936-
/// May be it will be solved in the future
3937-
mod choice_and_choice {
3938-
use super::*;
3939-
use pretty_assertions::assert_eq;
3940-
3941-
#[derive(Debug, PartialEq, Deserialize)]
3942-
struct Pair {
3943-
#[serde(rename = "$value")]
3944-
item: Vec<Choice>,
3945-
// Actually, we cannot rename both fields to `$value`, which is now
3946-
// required to indicate, that field accepts elements with any name
3947-
#[serde(rename = "$value")]
3948-
element: Vec<Choice2>,
3949-
}
3950-
3951-
#[test]
3952-
#[ignore = "There is no way to associate XML elements with `item` or `element` without extra knowledge from type"]
3953-
fn splitted() {
3954-
let data: Pair = from_str(
3955-
r#"
3956-
<root>
3957-
<first/>
3958-
<second/>
3959-
<one/>
3960-
<two/>
3961-
<three/>
3962-
</root>
3963-
"#,
3964-
)
3965-
.unwrap();
3966-
3967-
assert_eq!(
3968-
data,
3969-
Pair {
3970-
item: vec![Choice::One, Choice::Two, Choice::Other("three".into())],
3971-
element: vec![Choice2::First, Choice2::Second],
3972-
}
3973-
);
3974-
}
3975-
3976-
#[test]
3977-
#[ignore = "There is no way to associate XML elements with `item` or `element` without extra knowledge from type"]
3978-
fn overlapped() {
3979-
let data = from_str::<Pair>(
3980-
r#"
3981-
<root>
3982-
<one/>
3983-
<first/>
3984-
<two/>
3985-
<second/>
3986-
<three/>
3987-
</root>
3988-
"#,
3989-
);
3990-
3991-
#[cfg(feature = "overlapped-lists")]
3992-
assert_eq!(
3993-
data.unwrap(),
3994-
Pair {
3995-
item: vec![Choice::One, Choice::Two, Choice::Other("three".into())],
3996-
element: vec![Choice2::First, Choice2::Second],
3997-
}
3998-
);
3999-
4000-
#[cfg(not(feature = "overlapped-lists"))]
4001-
match data {
4002-
Err(DeError::Custom(e)) => {
4003-
assert_eq!(e, "invalid length 1, expected an array of length 3")
4004-
}
4005-
e => panic!(
4006-
r#"Expected `Err(Custom("invalid length 1, expected an array of length 3"))`, but got `{:?}`"#,
4007-
e
4008-
),
4009-
}
4010-
}
4011-
}
3872+
// choice_and_choice struct like
3873+
//
3874+
// #[derive(Deserialize)]
3875+
// struct Pair {
3876+
// #[serde(rename = "$value")]
3877+
// item: Vec<Choice>,
3878+
//
3879+
// #[serde(rename = "$value")]
3880+
// element: Vec<Choice2>,
3881+
// }
3882+
//
3883+
// cannot be implemented because both fields should be renamed to the
3884+
// same name $value. Derived implementation will never try to deserialize
3885+
// `element`
40123886
}
40133887

40143888
/// Deserialization of primitives slightly differs from deserialization

0 commit comments

Comments
 (0)