129129//! That will print
130130//!
131131//! ```text
132- //! json atom at path ".a.b" is missing from expected
132+ //! json atom at path ".a.b" is missing from actual
133133//! ```
134134//!
135135//! ## Exact matching
153153//! This will panic with the error message:
154154//!
155155//! ```text
156- //! json atom at path ".a.b" is missing from rhs
156+ //! json atom at path ".a.b" is missing from lhs
157157//! ```
158158
159159#![ deny(
@@ -633,7 +633,7 @@ impl MatchErrors {
633633 . indent( 8 ) ,
634634 ) ,
635635 ErrorType :: MissingPath ( Either :: Left ( path) ) => {
636- format ! ( r#"json atom at path "{}" is missing from expected "# , path)
636+ format ! ( r#"json atom at path "{}" is missing from actual "# , path)
637637 }
638638 ErrorType :: MissingPath ( Either :: Right ( ( path, SideWithoutPath :: Lhs ) ) ) => {
639639 format ! ( r#"json atom at path "{}" is missing from lhs"# , path)
@@ -811,7 +811,13 @@ mod tests {
811811 ) ;
812812 assert_output_eq (
813813 result,
814- Err ( r#"json atom at path ".a.b" is missing from expected"# ) ,
814+ Err ( r#"json atom at path ".a.b" is missing from actual"# ) ,
815+ ) ;
816+
817+ let result = test_partial_match ( Actual ( json ! ( { } ) ) , Expected ( json ! ( { "a" : true } ) ) ) ;
818+ assert_output_eq (
819+ result,
820+ Err ( r#"json atom at path ".a" is missing from actual"# ) ,
815821 ) ;
816822
817823 let result = test_partial_match (
@@ -880,7 +886,7 @@ mod tests {
880886 ) ;
881887 assert_output_eq (
882888 result,
883- Err ( r#"json atom at path ".a[2]" is missing from expected "# ) ,
889+ Err ( r#"json atom at path ".a[2]" is missing from actual "# ) ,
884890 ) ;
885891 }
886892
@@ -902,12 +908,6 @@ mod tests {
902908 "b""# ) ,
903909 ) ;
904910
905- let result = test_exact_match ( json ! ( { "a" : { } } ) , json ! ( { "a" : { "b" : true } } ) ) ;
906- assert_output_eq (
907- result,
908- Err ( r#"json atom at path ".a.b" is missing from lhs"# ) ,
909- ) ;
910-
911911 let result = test_exact_match (
912912 json ! ( { "a" : [ 1 , { "b" : 2 } ] } ) ,
913913 json ! ( { "a" : [ 1 , { "b" : 3 } ] } ) ,
@@ -930,7 +930,7 @@ mod tests {
930930 Err ( r#"json atom at path ".a.b" is missing from rhs"# ) ,
931931 ) ;
932932
933- let result = test_exact_match ( json ! ( { "a" : { } } ) , json ! ( { "a" : { "b" : 1 } } ) ) ;
933+ let result = test_exact_match ( json ! ( { "a" : { } } ) , json ! ( { "a" : { "b" : 1 } } ) ) ;
934934 assert_output_eq (
935935 result,
936936 Err ( r#"json atom at path ".a.b" is missing from lhs"# ) ,
@@ -958,10 +958,10 @@ mod tests {
958958 return ;
959959 } else {
960960 println ! ( "Errors didn't match" ) ;
961- println ! ( "Actual:" ) ;
962- println ! ( "{}" , actual_error) ;
963961 println ! ( "Expected:" ) ;
964962 println ! ( "{}" , expected_error) ;
963+ println ! ( "Got:" ) ;
964+ println ! ( "{}" , actual_error) ;
965965 }
966966 }
967967 }
0 commit comments