@@ -1120,7 +1120,7 @@ impl<'a, 'v> Visitor<'v> for MacroExterminator<'a> {
1120
1120
#[ cfg( test) ]
1121
1121
mod test {
1122
1122
use super :: { pattern_bindings, expand_crate, contains_macro_escape} ;
1123
- use super :: { PatIdentFinder , IdentRenamer , PatIdentRenamer } ;
1123
+ use super :: { PatIdentFinder , IdentRenamer , PatIdentRenamer , ExpansionConfig } ;
1124
1124
use ast;
1125
1125
use ast:: { Attribute_ , AttrOuter , MetaWord , Name } ;
1126
1126
use attr;
@@ -1185,6 +1185,13 @@ mod test {
1185
1185
// these following tests are quite fragile, in that they don't test what
1186
1186
// *kind* of failure occurs.
1187
1187
1188
+ fn test_ecfg ( ) -> ExpansionConfig {
1189
+ ExpansionConfig {
1190
+ deriving_hash_type_parameter : false ,
1191
+ crate_name : "test" . to_string ( ) ,
1192
+ }
1193
+ }
1194
+
1188
1195
// make sure that macros can't escape fns
1189
1196
#[ should_fail]
1190
1197
#[ test] fn macros_cant_escape_fns_test ( ) {
@@ -1196,11 +1203,7 @@ mod test {
1196
1203
src,
1197
1204
Vec :: new ( ) , & sess) ;
1198
1205
// should fail:
1199
- let cfg = :: syntax:: ext:: expand:: ExpansionConfig {
1200
- deriving_hash_type_parameter : false ,
1201
- crate_name : "test" . to_string ( ) ,
1202
- } ;
1203
- expand_crate ( & sess, cfg, vec ! ( ) , vec ! ( ) , crate_ast) ;
1206
+ expand_crate ( & sess, test_ecfg ( ) , vec ! ( ) , vec ! ( ) , crate_ast) ;
1204
1207
}
1205
1208
1206
1209
// make sure that macros can't escape modules
@@ -1213,11 +1216,7 @@ mod test {
1213
1216
"<test>" . to_string ( ) ,
1214
1217
src,
1215
1218
Vec :: new ( ) , & sess) ;
1216
- let cfg = :: syntax:: ext:: expand:: ExpansionConfig {
1217
- deriving_hash_type_parameter : false ,
1218
- crate_name : "test" . to_string ( ) ,
1219
- } ;
1220
- expand_crate ( & sess, cfg, vec ! ( ) , vec ! ( ) , crate_ast) ;
1219
+ expand_crate ( & sess, test_ecfg ( ) , vec ! ( ) , vec ! ( ) , crate_ast) ;
1221
1220
}
1222
1221
1223
1222
// macro_escape modules should allow macros to escape
@@ -1229,11 +1228,7 @@ mod test {
1229
1228
"<test>" . to_string ( ) ,
1230
1229
src,
1231
1230
Vec :: new ( ) , & sess) ;
1232
- let cfg = :: syntax:: ext:: expand:: ExpansionConfig {
1233
- deriving_hash_type_parameter : false ,
1234
- crate_name : "test" . to_string ( ) ,
1235
- } ;
1236
- expand_crate ( & sess, cfg, vec ! ( ) , vec ! ( ) , crate_ast) ;
1231
+ expand_crate ( & sess, test_ecfg ( ) , vec ! ( ) , vec ! ( ) , crate_ast) ;
1237
1232
}
1238
1233
1239
1234
#[ test] fn test_contains_flatten ( ) {
@@ -1266,11 +1261,7 @@ mod test {
1266
1261
let ps = parse:: new_parse_sess ( ) ;
1267
1262
let crate_ast = string_to_parser ( & ps, crate_str) . parse_crate_mod ( ) ;
1268
1263
// the cfg argument actually does matter, here...
1269
- let cfg = :: syntax:: ext:: expand:: ExpansionConfig {
1270
- deriving_hash_type_parameter : false ,
1271
- crate_name : "test" . to_string ( ) ,
1272
- } ;
1273
- expand_crate ( & ps, cfg, vec ! ( ) , vec ! ( ) , crate_ast)
1264
+ expand_crate ( & ps, test_ecfg ( ) , vec ! ( ) , vec ! ( ) , crate_ast)
1274
1265
}
1275
1266
1276
1267
// find the pat_ident paths in a crate
0 commit comments