Skip to content

Commit

Permalink
Run tree builder and tokenizer tests again.
Browse files Browse the repository at this point in the history
libtest now ignores our #[start] trick:

https://github.com/rust-lang/rust/blob/8dba06aeee28e9ed6a1b9918a91cbef242af53d3/src/libsyntax/test.rs#L205-L207

This runs a test harness nested in another. It’s not pretty, but it works.
  • Loading branch information
SimonSapin committed Sep 1, 2015
1 parent 0e685c7 commit df8e749
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
12 changes: 4 additions & 8 deletions tests/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg_attr(feature = "unstable", feature(start, rt, test, plugin))]
#![cfg_attr(feature = "unstable", feature(test, plugin))]
#![cfg_attr(feature = "unstable", plugin(string_cache_plugin))]

#[cfg(feature = "unstable")] extern crate test;
Expand All @@ -20,7 +20,7 @@ extern crate html5ever;
mod foreach_html5lib_test;
use foreach_html5lib_test::foreach_html5lib_test;

use std::{char, env, rt};
use std::{char, env};
use std::ffi::OsStr;
use std::mem::replace;
use std::default::Default;
Expand Down Expand Up @@ -422,12 +422,8 @@ fn tests(src_dir: &Path) -> Vec<TestDescAndFn> {
}

#[cfg(feature = "unstable")]
#[start]
fn start(argc: isize, argv: *const *const u8) -> isize {
unsafe {
rt::args::init(argc, argv);
}
#[test]
fn run() {
let args: Vec<_> = env::args().collect();
test::test_main(&args, tests(Path::new(env!("CARGO_MANIFEST_DIR"))));
0
}
12 changes: 4 additions & 8 deletions tests/tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg_attr(feature = "unstable", feature(start, rt, test, plugin))]
#![cfg_attr(feature = "unstable", feature(test, plugin))]
#![cfg_attr(feature = "unstable", plugin(string_cache_plugin))]

#[cfg(feature = "unstable")] extern crate test;
Expand All @@ -19,7 +19,7 @@ extern crate html5ever;
mod foreach_html5lib_test;
use foreach_html5lib_test::foreach_html5lib_test;

use std::{fs, io, env, rt};
use std::{fs, io, env};
use std::io::BufRead;
use std::ffi::OsStr;
use std::iter::repeat;
Expand Down Expand Up @@ -266,11 +266,8 @@ fn tests(src_dir: &Path, ignores: &HashSet<String>) -> Vec<TestDescAndFn> {
}

#[cfg(feature = "unstable")]
#[start]
fn start(argc: isize, argv: *const *const u8) -> isize {
unsafe {
rt::args::init(argc, argv);
}
#[test]
fn run() {
let args: Vec<_> = env::args().collect();
let src_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let mut ignores = HashSet::new();
Expand All @@ -283,5 +280,4 @@ fn start(argc: isize, argv: *const *const u8) -> isize {
}

test::test_main(&args, tests(src_dir, &ignores));
0
}

0 comments on commit df8e749

Please sign in to comment.