Skip to content

Commit 38fa3bc

Browse files
Mingundralley
authored andcommitted
Add regression test for #510
failures (1): issue510
1 parent e03bac7 commit 38fa3bc

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/serde-issues.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,48 @@ fn issue500() {
241241
);
242242
}
243243

244+
/// Regression test for https://github.com/tafia/quick-xml/issues/510.
245+
#[test]
246+
fn issue510() {
247+
#[derive(Debug, PartialEq, Serialize, Deserialize)]
248+
#[serde(rename = "ENTRY")]
249+
struct Entry {
250+
#[serde(rename = "CUE_V2")]
251+
cues: Option<Vec<Cue>>,
252+
}
253+
254+
#[derive(Debug, PartialEq, Serialize, Deserialize)]
255+
// #[serde_with::serde_as]
256+
struct Cue {
257+
#[serde(rename = "@NAME")]
258+
name: String,
259+
}
260+
261+
let data: Entry = from_str(
262+
"\
263+
<ENTRY>\
264+
<CUE_V2 NAME='foo'></CUE_V2>\
265+
<CUE_V2 NAME='bar'></CUE_V2>\
266+
</ENTRY>\
267+
",
268+
)
269+
.unwrap();
270+
271+
assert_eq!(
272+
data,
273+
Entry {
274+
cues: Some(vec![
275+
Cue {
276+
name: "foo".to_string(),
277+
},
278+
Cue {
279+
name: "bar".to_string(),
280+
},
281+
]),
282+
}
283+
);
284+
}
285+
244286
/// Regression test for https://github.com/tafia/quick-xml/issues/537.
245287
///
246288
/// This test checks that special `xmlns:xxx` attributes uses full name of

0 commit comments

Comments
 (0)