File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -201,9 +201,15 @@ macro_rules! assert_json_include {
201
201
panic!( "\n \n {}\n \n " , error) ;
202
202
}
203
203
} } ;
204
+ ( actual: $actual: expr, expected: $expected: expr, ) => { {
205
+ $crate:: assert_json_include!( actual: $actual, expected: $expected)
206
+ } } ;
204
207
( expected: $expected: expr, actual: $actual: expr) => { {
205
208
$crate:: assert_json_include!( actual: $actual, expected: $expected)
206
209
} } ;
210
+ ( expected: $expected: expr, actual: $actual: expr, ) => { {
211
+ $crate:: assert_json_include!( actual: $actual, expected: $expected)
212
+ } } ;
207
213
}
208
214
209
215
/// The macro used to compare two JSON values for an exact match.
@@ -222,6 +228,9 @@ macro_rules! assert_json_eq {
222
228
panic!( "\n \n {}\n \n " , error) ;
223
229
}
224
230
} } ;
231
+ ( $lhs: expr, $rhs: expr, ) => { {
232
+ $crate:: assert_json_eq!( $lhs, $rhs)
233
+ } } ;
225
234
}
226
235
227
236
/// Perform the matching and return the error text rather than panicing.
Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ fn can_pass() {
14
14
actual: json!( { "a" : { "b" : true } } ) ,
15
15
expected: json!( { "a" : { } } )
16
16
) ;
17
+
18
+ assert_json_include ! (
19
+ actual: json!( { "a" : { "b" : true } } ) ,
20
+ expected: json!( { "a" : { } } ) ,
21
+ ) ;
22
+
23
+ assert_json_include ! (
24
+ expected: json!( { "a" : { } } ) ,
25
+ actual: json!( { "a" : { "b" : true } } ) ,
26
+ ) ;
17
27
}
18
28
19
29
#[ test]
@@ -28,6 +38,7 @@ fn can_fail() {
28
38
#[ test]
29
39
fn can_pass_with_exact_match ( ) {
30
40
assert_json_eq ! ( json!( { "a" : { "b" : true } } ) , json!( { "a" : { "b" : true } } ) ) ;
41
+ assert_json_eq ! ( json!( { "a" : { "b" : true } } ) , json!( { "a" : { "b" : true } } ) , ) ;
31
42
}
32
43
33
44
#[ test]
You can’t perform that action at this time.
0 commit comments