File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,43 @@ fn issue349() {
142142 ) ;
143143}
144144
145+ /// Regression test for https://github.com/tafia/quick-xml/issues/429.
146+ #[ test]
147+ fn issue429 ( ) {
148+ #[ derive( Debug , Deserialize , Serialize , PartialEq ) ]
149+ enum State {
150+ A ,
151+ B ,
152+ C ,
153+ }
154+
155+ #[ derive( Debug , Deserialize , Serialize , PartialEq ) ]
156+ struct StateOuter {
157+ #[ serde( rename = "$text" ) ]
158+ state : State ,
159+ }
160+
161+ #[ derive( Debug , Deserialize , Serialize , PartialEq ) ]
162+ pub struct Root {
163+ state : StateOuter ,
164+ }
165+
166+ assert_eq ! (
167+ from_str:: <Root >( "<root><state>B</state></root>" ) . unwrap( ) ,
168+ Root {
169+ state: StateOuter { state: State :: B }
170+ }
171+ ) ;
172+
173+ assert_eq ! (
174+ to_string( & Root {
175+ state: StateOuter { state: State :: B }
176+ } )
177+ . unwrap( ) ,
178+ "<Root><state>B</state></Root>"
179+ ) ;
180+ }
181+
145182/// Regression test for https://github.com/tafia/quick-xml/issues/537.
146183///
147184/// This test checks that special `xmlns:xxx` attributes uses full name of
You can’t perform that action at this time.
0 commit comments