File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,21 @@ mod trivial {
286286 assert_eq!( item, Trivial { value: $expected } ) ;
287287 }
288288
289+ #[ test]
290+ fn text_nested( ) {
291+ match from_str:: <Trivial <$type>>( & format!(
292+ "<root><nested>{}</nested></root>" ,
293+ $value
294+ ) ) {
295+ // Expected unexpected start element `<nested>`
296+ Err ( DeError :: Custom ( reason) ) => assert_eq!( reason, "missing field `$text`" ) ,
297+ x => panic!(
298+ r#"Expected `Err(Custom("missing field `$text`"))`, but got `{:?}`"# ,
299+ x
300+ ) ,
301+ }
302+ }
303+
289304 #[ test]
290305 fn text_tag_after( ) {
291306 // Unlike `wrapped` test, here we have a struct that is serialized to XML with
@@ -303,21 +318,6 @@ mod trivial {
303318 from_str( & format!( "<root><something-else/>{}</root>" , $value) ) . unwrap( ) ;
304319 assert_eq!( item, Trivial { value: $expected } ) ;
305320 }
306-
307- #[ test]
308- fn text_nested( ) {
309- match from_str:: <Trivial <$type>>( & format!(
310- "<root><nested>{}</nested></root>" ,
311- $value
312- ) ) {
313- // Expected unexpected start element `<nested>`
314- Err ( DeError :: Custom ( reason) ) => assert_eq!( reason, "missing field `$text`" ) ,
315- x => panic!(
316- r#"Expected `Err(Custom("missing field `$text`"))`, but got `{:?}`"# ,
317- x
318- ) ,
319- }
320- }
321321 }
322322 } ;
323323 }
You can’t perform that action at this time.
0 commit comments