@@ -21,14 +21,12 @@ impl MutVisitor for ToZzIdentMutVisitor {
21
21
}
22
22
}
23
23
24
- // Maybe add to `expand.rs`.
25
- macro_rules! assert_pred {
26
- ( $pred: expr, $predname: expr, $a: expr , $b: expr) => { {
27
- let pred_val = $pred;
24
+ macro_rules! assert_matches_codepattern {
25
+ ( $a: expr , $b: expr) => { {
28
26
let a_val = $a;
29
27
let b_val = $b;
30
- if !( pred_val ( & a_val, & b_val) ) {
31
- panic!( "expected args satisfying {} , got {} and {}" , $predname , a_val, b_val) ;
28
+ if !matches_codepattern ( & a_val, & b_val) {
29
+ panic!( "expected args satisfying `matches_codepattern` , got {} and {}" , a_val, b_val) ;
32
30
}
33
31
} } ;
34
32
}
@@ -41,9 +39,7 @@ fn ident_transformation() {
41
39
let mut krate =
42
40
string_to_crate ( "#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}" . to_string ( ) ) ;
43
41
zz_visitor. visit_crate ( & mut krate) ;
44
- assert_pred ! (
45
- matches_codepattern,
46
- "matches_codepattern" ,
42
+ assert_matches_codepattern ! (
47
43
print_crate_items( & krate) ,
48
44
"#[zz]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}" . to_string( )
49
45
) ;
@@ -61,9 +57,7 @@ fn ident_transformation_in_defs() {
61
57
. to_string ( ) ,
62
58
) ;
63
59
zz_visitor. visit_crate ( & mut krate) ;
64
- assert_pred ! (
65
- matches_codepattern,
66
- "matches_codepattern" ,
60
+ assert_matches_codepattern ! (
67
61
print_crate_items( & krate) ,
68
62
"macro_rules! zz{(zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+))}" . to_string( )
69
63
) ;
0 commit comments