We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 03deb70 commit cfda567Copy full SHA for cfda567
tests/serde-issues.rs
@@ -4,7 +4,7 @@
4
5
use pretty_assertions::assert_eq;
6
use quick_xml::de::from_str;
7
-use quick_xml::se::to_string;
+use quick_xml::se::{to_string, to_string_with_root};
8
use serde::{Deserialize, Serialize};
9
use std::collections::HashMap;
10
@@ -335,3 +335,28 @@ mod issue537 {
335
);
336
}
337
338
+
339
+#[test]
340
+fn issue540() {
341
+ #[derive(Serialize)]
342
+ pub enum Enum {
343
+ Variant {},
344
+ }
345
346
347
+ pub struct Struct {
348
+ #[serde(flatten)]
349
+ flatten: Enum,
350
351
352
+ assert_eq!(
353
+ to_string_with_root(
354
+ "root",
355
+ &Struct {
356
+ flatten: Enum::Variant {},
357
358
+ )
359
+ .unwrap(),
360
+ "<root><Variant/></root>"
361
+ );
362
+}
0 commit comments