Skip to content

Commit 56b9731

Browse files
Mingundralley
authored andcommitted
Add regression test for #349
1 parent e9f98cf commit 56b9731

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/serde-issues.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,35 @@ fn issue343() {
113113
assert_eq!(to_string(&users).unwrap(), xml);
114114
}
115115

116+
/// Regression test for https://github.com/tafia/quick-xml/issues/349.
117+
#[test]
118+
fn issue349() {
119+
#[derive(Debug, Deserialize, Serialize, PartialEq)]
120+
struct Entity {
121+
id: Id,
122+
}
123+
#[derive(Debug, Deserialize, Serialize, PartialEq)]
124+
struct Id {
125+
#[serde(rename = "$value")]
126+
content: Enum,
127+
}
128+
#[derive(Debug, Deserialize, Serialize, PartialEq)]
129+
#[serde(rename_all = "kebab-case")]
130+
enum Enum {
131+
A(String),
132+
B(String),
133+
}
134+
135+
assert_eq!(
136+
from_str::<Entity>("<entity><id><a>Id</a></id></entity>").unwrap(),
137+
Entity {
138+
id: Id {
139+
content: Enum::A("Id".to_string()),
140+
}
141+
}
142+
);
143+
}
144+
116145
/// Regression test for https://github.com/tafia/quick-xml/issues/537.
117146
///
118147
/// This test checks that special `xmlns:xxx` attributes uses full name of

0 commit comments

Comments
 (0)