@@ -1112,7 +1112,7 @@ impl<'a, 'v> Visitor<'v> for MacroExterminator<'a> {
1112
1112
#[ cfg( test) ]
1113
1113
mod test {
1114
1114
use super :: { pattern_bindings, expand_crate, contains_macro_escape} ;
1115
- use super :: { PatIdentFinder , IdentRenamer , PatIdentRenamer } ;
1115
+ use super :: { PatIdentFinder , IdentRenamer , PatIdentRenamer , ExpansionConfig } ;
1116
1116
use ast;
1117
1117
use ast:: { Attribute_ , AttrOuter , MetaWord , Name } ;
1118
1118
use attr;
@@ -1177,6 +1177,13 @@ mod test {
1177
1177
// these following tests are quite fragile, in that they don't test what
1178
1178
// *kind* of failure occurs.
1179
1179
1180
+ fn test_ecfg ( ) -> ExpansionConfig {
1181
+ ExpansionConfig {
1182
+ deriving_hash_type_parameter : false ,
1183
+ crate_name : "test" . to_string ( ) ,
1184
+ }
1185
+ }
1186
+
1180
1187
// make sure that macros can't escape fns
1181
1188
#[ should_fail]
1182
1189
#[ test] fn macros_cant_escape_fns_test ( ) {
@@ -1188,11 +1195,7 @@ mod test {
1188
1195
src,
1189
1196
Vec :: new ( ) , & sess) ;
1190
1197
// should fail:
1191
- let cfg = :: syntax:: ext:: expand:: ExpansionConfig {
1192
- deriving_hash_type_parameter : false ,
1193
- crate_name : "test" . to_string ( ) ,
1194
- } ;
1195
- expand_crate ( & sess, cfg, vec ! ( ) , vec ! ( ) , crate_ast) ;
1198
+ expand_crate ( & sess, test_ecfg ( ) , vec ! ( ) , vec ! ( ) , crate_ast) ;
1196
1199
}
1197
1200
1198
1201
// make sure that macros can't escape modules
@@ -1205,11 +1208,7 @@ mod test {
1205
1208
"<test>" . to_string ( ) ,
1206
1209
src,
1207
1210
Vec :: new ( ) , & sess) ;
1208
- let cfg = :: syntax:: ext:: expand:: ExpansionConfig {
1209
- deriving_hash_type_parameter : false ,
1210
- crate_name : "test" . to_string ( ) ,
1211
- } ;
1212
- expand_crate ( & sess, cfg, vec ! ( ) , vec ! ( ) , crate_ast) ;
1211
+ expand_crate ( & sess, test_ecfg ( ) , vec ! ( ) , vec ! ( ) , crate_ast) ;
1213
1212
}
1214
1213
1215
1214
// macro_escape modules should allow macros to escape
@@ -1221,11 +1220,7 @@ mod test {
1221
1220
"<test>" . to_string ( ) ,
1222
1221
src,
1223
1222
Vec :: new ( ) , & sess) ;
1224
- let cfg = :: syntax:: ext:: expand:: ExpansionConfig {
1225
- deriving_hash_type_parameter : false ,
1226
- crate_name : "test" . to_string ( ) ,
1227
- } ;
1228
- expand_crate ( & sess, cfg, vec ! ( ) , vec ! ( ) , crate_ast) ;
1223
+ expand_crate ( & sess, test_ecfg ( ) , vec ! ( ) , vec ! ( ) , crate_ast) ;
1229
1224
}
1230
1225
1231
1226
#[ test] fn test_contains_flatten ( ) {
@@ -1258,11 +1253,7 @@ mod test {
1258
1253
let ps = parse:: new_parse_sess ( ) ;
1259
1254
let crate_ast = string_to_parser ( & ps, crate_str) . parse_crate_mod ( ) ;
1260
1255
// the cfg argument actually does matter, here...
1261
- let cfg = :: syntax:: ext:: expand:: ExpansionConfig {
1262
- deriving_hash_type_parameter : false ,
1263
- crate_name : "test" . to_string ( ) ,
1264
- } ;
1265
- expand_crate ( & ps, cfg, vec ! ( ) , vec ! ( ) , crate_ast)
1256
+ expand_crate ( & ps, test_ecfg ( ) , vec ! ( ) , vec ! ( ) , crate_ast)
1266
1257
}
1267
1258
1268
1259
// find the pat_ident paths in a crate
0 commit comments