@@ -415,34 +415,12 @@ fn mk_test_wrapper(cx: test_ctxt,
415
415
}
416
416
417
417
fn mk_main( cx : test_ctxt ) -> @ast:: item {
418
- let str_pt = path_node ( ~[ cx. sess . ident_of ( ~"str") ] ) ;
419
- let str_ty_inner = @{ id: cx. sess . next_node_id ( ) ,
420
- node: ast:: ty_path ( str_pt, cx. sess . next_node_id ( ) ) ,
421
- span: dummy_sp ( ) } ;
422
- let str_ty = @{ id: cx. sess . next_node_id ( ) ,
423
- node: ast:: ty_uniq ( { ty: str_ty_inner, mutbl: ast:: m_imm} ) ,
424
- span: dummy_sp ( ) } ;
425
- let args_mt = { ty: str_ty, mutbl: ast:: m_imm} ;
426
- let args_ty_inner = @{ id: cx. sess . next_node_id ( ) ,
427
- node: ast:: ty_vec ( args_mt) ,
428
- span: dummy_sp ( ) } ;
429
- let args_ty = { id: cx. sess . next_node_id ( ) ,
430
- node: ast:: ty_uniq ( { ty: args_ty_inner, mutbl: ast:: m_imm} ) ,
431
- span: dummy_sp ( ) } ;
432
-
433
-
434
- let args_arg: ast:: arg =
435
- { mode: ast:: expl ( ast:: by_val) ,
436
- ty: @args_ty,
437
- ident: cx. sess . ident_of ( ~"args") ,
438
- id: cx. sess . next_node_id ( ) } ;
439
-
440
418
let ret_ty = { id: cx. sess . next_node_id ( ) ,
441
419
node: ast:: ty_nil,
442
420
span: dummy_sp ( ) } ;
443
421
444
422
let decl: ast:: fn_decl =
445
- { inputs: ~[ args_arg ] ,
423
+ { inputs: ~[ ] ,
446
424
output: @ret_ty,
447
425
cf: ast:: return_val} ;
448
426
@@ -465,16 +443,24 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
465
443
}
466
444
467
445
fn mk_test_main_call ( cx : test_ctxt ) -> @ast:: expr {
468
-
469
- // Get the args passed to main so we can pass the to test_main
470
- let args_path = path_node ( ~[ cx. sess . ident_of ( ~"args") ] ) ;
446
+ // Call os::args to generate the vector of test_descs
447
+ let args_path = path_node ( ~[
448
+ cx. sess . ident_of ( ~"os") ,
449
+ cx. sess . ident_of ( ~"args")
450
+ ] ) ;
471
451
472
452
let args_path_expr_: ast:: expr_ = ast:: expr_path ( args_path) ;
473
453
474
454
let args_path_expr: ast:: expr =
475
455
{ id: cx. sess . next_node_id ( ) , callee_id: cx. sess . next_node_id ( ) ,
476
456
node: args_path_expr_, span: dummy_sp ( ) } ;
477
457
458
+ let args_call_expr_ = ast:: expr_call ( @args_path_expr, ~[ ] , false ) ;
459
+
460
+ let args_call_expr: ast:: expr =
461
+ { id: cx. sess . next_node_id ( ) , callee_id: cx. sess . next_node_id ( ) ,
462
+ node: args_call_expr_, span: dummy_sp ( ) } ;
463
+
478
464
// Call __test::test to generate the vector of test_descs
479
465
let test_path = path_node ( ~[ cx. sess . ident_of ( ~"tests") ] ) ;
480
466
@@ -503,7 +489,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr {
503
489
504
490
let test_main_call_expr_: ast:: expr_ =
505
491
ast:: expr_call ( @test_main_path_expr,
506
- ~[ @args_path_expr , @test_call_expr] , false ) ;
492
+ ~[ @args_call_expr , @test_call_expr] , false ) ;
507
493
508
494
let test_main_call_expr: ast:: expr =
509
495
{ id: cx. sess . next_node_id ( ) , callee_id: cx. sess . next_node_id ( ) ,
0 commit comments