@@ -6,13 +6,14 @@ import syntax::ast_util::*;
6
6
//import syntax::ast_util::dummy_sp;
7
7
import syntax:: fold;
8
8
import syntax:: print:: pprust;
9
+ import syntax:: codemap:: span;
9
10
import front:: attr;
10
11
11
12
export modify_for_testing;
12
13
13
14
type node_id_gen = fn ( ) -> ast:: node_id ;
14
15
15
- type test = { path: [ ast:: ident ] , ignore : bool } ;
16
+ type test = { span : span , path: [ ast:: ident ] , ignore : bool } ;
16
17
17
18
type test_ctxt =
18
19
@{ next_node_id : node_id_gen ,
@@ -90,7 +91,7 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
90
91
91
92
if is_test_fn ( i) {
92
93
log "this is a test function" ;
93
- let test = { path: cx. path , ignore: is_ignored ( i) } ;
94
+ let test = { span : i . span , path: cx. path , ignore: is_ignored ( i) } ;
94
95
cx. testfns += [ test] ;
95
96
log #fmt[ "have %u test functions" , vec:: len ( cx. testfns ) ] ;
96
97
}
@@ -237,6 +238,7 @@ fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr {
237
238
}
238
239
239
240
fn mk_test_desc_rec ( cx : test_ctxt , test : test ) -> @ast:: expr {
241
+ let span = test. span ;
240
242
let path = test. path ;
241
243
242
244
log #fmt[ "encoding %s" , ast_util:: path_name_i ( path) ] ;
@@ -246,7 +248,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
246
248
let name_expr: ast:: expr =
247
249
{ id: cx. next_node_id ( ) ,
248
250
node: ast:: expr_lit ( @name_lit) ,
249
- span: dummy_sp ( ) } ;
251
+ span: span } ;
250
252
251
253
let name_field: ast:: field =
252
254
nospan ( { mut: ast:: imm, ident: "name" , expr: @name_expr} ) ;
@@ -256,7 +258,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
256
258
let fn_expr: ast:: expr =
257
259
{ id: cx. next_node_id ( ) ,
258
260
node: ast:: expr_path ( fn_path) ,
259
- span: dummy_sp ( ) } ;
261
+ span: span } ;
260
262
261
263
let fn_field: ast:: field =
262
264
nospan ( { mut: ast:: imm, ident: "fn" , expr: @fn_expr} ) ;
@@ -266,15 +268,15 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
266
268
let ignore_expr: ast:: expr =
267
269
{ id: cx. next_node_id ( ) ,
268
270
node: ast:: expr_lit ( @ignore_lit) ,
269
- span: dummy_sp ( ) } ;
271
+ span: span } ;
270
272
271
273
let ignore_field: ast:: field =
272
274
nospan ( { mut: ast:: imm, ident: "ignore" , expr: @ignore_expr} ) ;
273
275
274
276
let desc_rec_: ast:: expr_ =
275
277
ast:: expr_rec ( [ name_field, fn_field, ignore_field] , option:: none) ;
276
278
let desc_rec: ast:: expr =
277
- { id: cx. next_node_id ( ) , node: desc_rec_, span: dummy_sp ( ) } ;
279
+ { id: cx. next_node_id ( ) , node: desc_rec_, span: span } ;
278
280
ret @desc_rec;
279
281
}
280
282
0 commit comments