File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -3480,6 +3480,18 @@ macro_rules! maplike_errors {
3480
3480
mod non_closed {
3481
3481
use super :: * ;
3482
3482
3483
+ /// For struct we expect that error about not closed tag appears
3484
+ /// earlier than error about missing fields
3485
+ #[ test]
3486
+ fn missing_field( ) {
3487
+ let data = from_str:: <$type>( r#"<root>"# ) ;
3488
+
3489
+ match data {
3490
+ Err ( DeError :: UnexpectedEof ) => ( ) ,
3491
+ _ => panic!( "Expected `UnexpectedEof`, found {:?}" , data) ,
3492
+ }
3493
+ }
3494
+
3483
3495
#[ test]
3484
3496
fn attributes( ) {
3485
3497
let data = from_str:: <$type>( r#"<root float="42" string="answer">"# ) ;
@@ -3515,6 +3527,18 @@ macro_rules! maplike_errors {
3515
3527
use super :: * ;
3516
3528
use quick_xml:: Error :: EndEventMismatch ;
3517
3529
3530
+ /// For struct we expect that error about mismatched tag appears
3531
+ /// earlier than error about missing fields
3532
+ #[ test]
3533
+ fn missing_field( ) {
3534
+ let data = from_str:: <$type>( r#"<root></mismatched>"# ) ;
3535
+
3536
+ match data {
3537
+ Err ( DeError :: InvalidXml ( EndEventMismatch { .. } ) ) => ( ) ,
3538
+ _ => panic!( "Expected `InvalidXml(EndEventMismatch)`, found {:?}" , data) ,
3539
+ }
3540
+ }
3541
+
3518
3542
#[ test]
3519
3543
fn attributes( ) {
3520
3544
let data = from_str:: <$type>(
You can’t perform that action at this time.
0 commit comments