@@ -415,34 +415,12 @@ fn mk_test_wrapper(cx: test_ctxt,
415415}
416416
417417fn 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-
440418 let ret_ty = { id: cx. sess . next_node_id ( ) ,
441419 node: ast:: ty_nil,
442420 span: dummy_sp ( ) } ;
443421
444422 let decl: ast:: fn_decl =
445- { inputs: ~[ args_arg ] ,
423+ { inputs: ~[ ] ,
446424 output: @ret_ty,
447425 cf: ast:: return_val} ;
448426
@@ -465,16 +443,24 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
465443}
466444
467445fn 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+ ] ) ;
471451
472452 let args_path_expr_: ast:: expr_ = ast:: expr_path ( args_path) ;
473453
474454 let args_path_expr: ast:: expr =
475455 { id: cx. sess . next_node_id ( ) , callee_id: cx. sess . next_node_id ( ) ,
476456 node: args_path_expr_, span: dummy_sp ( ) } ;
477457
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+
478464 // Call __test::test to generate the vector of test_descs
479465 let test_path = path_node ( ~[ cx. sess . ident_of ( ~"tests") ] ) ;
480466
@@ -503,7 +489,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr {
503489
504490 let test_main_call_expr_: ast:: expr_ =
505491 ast:: expr_call ( @test_main_path_expr,
506- ~[ @args_path_expr , @test_call_expr] , false ) ;
492+ ~[ @args_call_expr , @test_call_expr] , false ) ;
507493
508494 let test_main_call_expr: ast:: expr =
509495 { id: cx. sess . next_node_id ( ) , callee_id: cx. sess . next_node_id ( ) ,
0 commit comments