diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-09-16 23:34:40 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-09-18 11:07:22 -0700 |
| commit | 817576ee7001244da68a4ee315ebdc1163d4e648 (patch) | |
| tree | ffa6ecd790e899105cfa3f2c2da1b4520a062f72 /src/librustc/front | |
| parent | e02313a172acca34bd29e10cdd10f7495664694e (diff) | |
| download | rust-817576ee7001244da68a4ee315ebdc1163d4e648.tar.gz rust-817576ee7001244da68a4ee315ebdc1163d4e648.zip | |
Register new snapshots
Diffstat (limited to 'src/librustc/front')
| -rw-r--r-- | src/librustc/front/test.rs | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 9c788065133..49176c7bc17 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -293,50 +293,6 @@ fn mk_std(cx: &TestCtxt) -> ast::view_item { } } -#[cfg(stage0)] -fn mk_test_module(cx: &TestCtxt) -> @ast::item { - - // Link to extra - let view_items = ~[mk_std(cx)]; - - // A constant vector of test descriptors. - let tests = mk_tests(cx); - - // The synthesized main function which will call the console test runner - // with our list of tests - let ext_cx = cx.ext_cx; - let mainfn = (quote_item!( - pub fn main() { - #[main]; - extra::test::test_main_static(::std::os::args(), TESTS); - } - )).unwrap(); - - let testmod = ast::_mod { - view_items: view_items, - items: ~[mainfn, tests], - }; - let item_ = ast::item_mod(testmod); - - // This attribute tells resolve to let us call unexported functions - let resolve_unexported_attr = - attr::mk_attr(attr::mk_word_item(@"!resolve_unexported")); - - let item = ast::item { - ident: cx.sess.ident_of("__test"), - attrs: ~[resolve_unexported_attr], - id: ast::DUMMY_NODE_ID, - node: item_, - vis: ast::public, - span: dummy_sp(), - }; - - debug!("Synthetic test module:\n%s\n", - pprust::item_to_str(@item.clone(), cx.sess.intr())); - - return @item; -} -#[cfg(not(stage0))] fn mk_test_module(cx: &TestCtxt) -> @ast::item { // Link to extra @@ -407,21 +363,6 @@ fn path_node_global(ids: ~[ast::Ident]) -> ast::Path { } } -#[cfg(stage0)] -fn mk_tests(cx: &TestCtxt) -> @ast::item { - - let ext_cx = cx.ext_cx; - - // The vector of test_descs for this crate - let test_descs = mk_test_descs(cx); - - (quote_item!( - pub static TESTS : &'static [self::extra::test::TestDescAndFn] = - $test_descs - ; - )).unwrap() -} -#[cfg(not(stage0))] fn mk_tests(cx: &TestCtxt) -> @ast::item { // The vector of test_descs for this crate let test_descs = mk_test_descs(cx); @@ -461,63 +402,6 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr { } } -#[cfg(stage0)] -fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr { - let span = test.span; - let path = test.path.clone(); - - let ext_cx = cx.ext_cx; - - debug!("encoding %s", ast_util::path_name_i(path)); - - let name_lit: ast::lit = - nospan(ast::lit_str(ast_util::path_name_i(path).to_managed())); - - let name_expr = @ast::Expr { - id: ast::DUMMY_NODE_ID, - node: ast::ExprLit(@name_lit), - span: span - }; - - let fn_path = path_node_global(path); - - let fn_expr = @ast::Expr { - id: ast::DUMMY_NODE_ID, - node: ast::ExprPath(fn_path), - span: span, - }; - - let t_expr = if test.bench { - quote_expr!( self::extra::test::StaticBenchFn($fn_expr) ) - } else { - quote_expr!( self::extra::test::StaticTestFn($fn_expr) ) - }; - - let ignore_expr = if test.ignore { - quote_expr!( true ) - } else { - quote_expr!( false ) - }; - - let fail_expr = if test.should_fail { - quote_expr!( true ) - } else { - quote_expr!( false ) - }; - - let e = quote_expr!( - self::extra::test::TestDescAndFn { - desc: self::extra::test::TestDesc { - name: self::extra::test::StaticTestName($name_expr), - ignore: $ignore_expr, - should_fail: $fail_expr - }, - testfn: $t_expr, - } - ); - e -} -#[cfg(not(stage0))] fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr { let span = test.span; let path = test.path.clone(); |
