@@ -9,6 +9,7 @@ import syntax::codemap::span;
9
9
import driver:: session;
10
10
import session:: session;
11
11
import syntax:: attr;
12
+ import dvec:: { dvec, extensions} ;
12
13
13
14
export modify_for_testing;
14
15
@@ -20,7 +21,7 @@ type test_ctxt =
20
21
@{ sess : session:: session ,
21
22
crate : @ast:: crate ,
22
23
mut path: [ ast:: ident ] ,
23
- mut testfns : [ test ] } ;
24
+ testfns : dvec < test > } ;
24
25
25
26
// Traverse the crate, collecting all the test functions, eliding any
26
27
// existing main functions, and synthesizing a main test harness
@@ -40,7 +41,7 @@ fn generate_test_harness(sess: session::session,
40
41
@{ sess: sess,
41
42
crate : crate ,
42
43
mut path: [ ] ,
43
- mut testfns: [ ] } ;
44
+ testfns: dvec ( ) } ;
44
45
45
46
let precursor =
46
47
@{ fold_crate: fold:: wrap ( bind fold_crate ( cx, _, _) ) ,
@@ -110,8 +111,8 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
110
111
let test = { span: i. span ,
111
112
path: cx. path , ignore: is_ignored ( cx, i) ,
112
113
should_fail: should_fail ( i) } ;
113
- cx. testfns += [ test] ;
114
- #debug ( "have %u test functions" , vec :: len ( cx. testfns ) ) ;
114
+ cx. testfns . push ( test) ;
115
+ #debug ( "have %u test functions" , cx. testfns . len ( ) ) ;
115
116
}
116
117
}
117
118
}
@@ -269,11 +270,10 @@ fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty {
269
270
}
270
271
271
272
fn mk_test_desc_vec ( cx : test_ctxt ) -> @ast:: expr {
272
- #debug ( "building test vector from %u tests" , vec :: len ( cx. testfns ) ) ;
273
+ #debug ( "building test vector from %u tests" , cx. testfns . len ( ) ) ;
273
274
let mut descs = [ ] ;
274
275
for cx. testfns. each { |test|
275
- let test_ = test; // Satisfy alias analysis
276
- descs += [ mk_test_desc_rec( cx, test_) ] ;
276
+ descs += [ mk_test_desc_rec( cx, test) ] ;
277
277
}
278
278
279
279
ret @{ id : cx. sess . next_node_id ( ) ,
0 commit comments