129
129
//! That will print
130
130
//!
131
131
//! ```text
132
- //! json atom at path ".a.b" is missing from expected
132
+ //! json atom at path ".a.b" is missing from actual
133
133
//! ```
134
134
//!
135
135
//! ## Exact matching
153
153
//! This will panic with the error message:
154
154
//!
155
155
//! ```text
156
- //! json atom at path ".a.b" is missing from rhs
156
+ //! json atom at path ".a.b" is missing from lhs
157
157
//! ```
158
158
159
159
#![ deny(
@@ -633,7 +633,7 @@ impl MatchErrors {
633
633
. indent( 8 ) ,
634
634
) ,
635
635
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)
637
637
}
638
638
ErrorType :: MissingPath ( Either :: Right ( ( path, SideWithoutPath :: Lhs ) ) ) => {
639
639
format ! ( r#"json atom at path "{}" is missing from lhs"# , path)
@@ -811,7 +811,13 @@ mod tests {
811
811
) ;
812
812
assert_output_eq (
813
813
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"# ) ,
815
821
) ;
816
822
817
823
let result = test_partial_match (
@@ -880,7 +886,7 @@ mod tests {
880
886
) ;
881
887
assert_output_eq (
882
888
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 "# ) ,
884
890
) ;
885
891
}
886
892
@@ -902,12 +908,6 @@ mod tests {
902
908
"b""# ) ,
903
909
) ;
904
910
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
-
911
911
let result = test_exact_match (
912
912
json ! ( { "a" : [ 1 , { "b" : 2 } ] } ) ,
913
913
json ! ( { "a" : [ 1 , { "b" : 3 } ] } ) ,
@@ -930,7 +930,7 @@ mod tests {
930
930
Err ( r#"json atom at path ".a.b" is missing from rhs"# ) ,
931
931
) ;
932
932
933
- let result = test_exact_match ( json ! ( { "a" : { } } ) , json ! ( { "a" : { "b" : 1 } } ) ) ;
933
+ let result = test_exact_match ( json ! ( { "a" : { } } ) , json ! ( { "a" : { "b" : 1 } } ) ) ;
934
934
assert_output_eq (
935
935
result,
936
936
Err ( r#"json atom at path ".a.b" is missing from lhs"# ) ,
@@ -958,10 +958,10 @@ mod tests {
958
958
return ;
959
959
} else {
960
960
println ! ( "Errors didn't match" ) ;
961
- println ! ( "Actual:" ) ;
962
- println ! ( "{}" , actual_error) ;
963
961
println ! ( "Expected:" ) ;
964
962
println ! ( "{}" , expected_error) ;
963
+ println ! ( "Got:" ) ;
964
+ println ! ( "{}" , actual_error) ;
965
965
}
966
966
}
967
967
}
0 commit comments