librustc: Fix the test runner, the condition system, and core test. rs=bustage

This commit is contained in:
Patrick Walton 2012-12-27 17:53:04 -08:00
parent 84ce55e542
commit e26ca35b08
28 changed files with 91 additions and 13 deletions

View File

@ -16,6 +16,7 @@
//! Boolean logic
use bool;
use cmp;
use cmp::Eq;

View File

@ -14,6 +14,7 @@
#[forbid(deprecated_mode)];
#[forbid(deprecated_pattern)];
use char;
use cmp::Eq;
use str;
use u32;

View File

@ -473,6 +473,10 @@ impl<T: Copy> DList<T> {
#[cfg(test)]
mod tests {
#[legacy_exports];
use iter;
use vec;
#[test]
fn test_dlist_concat() {
let a = from_vec(~[1,2]);

View File

@ -21,6 +21,7 @@ Simple compression
use libc;
use libc::{c_void, size_t, c_int};
use ptr;
use rand;
use vec;
extern mod rustrt {
@ -91,8 +92,8 @@ fn test_flate_round_trip() {
}
debug!("de/inflate of %u bytes of random word-sequences",
in.len());
let cmp = flate::deflate_bytes(in);
let out = flate::inflate_bytes(cmp);
let cmp = deflate_bytes(in);
let out = inflate_bytes(cmp);
debug!("%u bytes deflated to %u (%.1f%% size)",
in.len(), cmp.len(),
100.0 * ((cmp.len() as float) / (in.len() as float)));

View File

@ -27,6 +27,7 @@
use m_float = f64;
use cmp::{Eq, Ord};
use cmp;
use f64;
use num;
use num::Num::from_int;

View File

@ -16,6 +16,7 @@ use T = self::inst::T;
use char;
use cmp::{Eq, Ord};
use cmp;
use from_str::FromStr;
use iter;
use num;

View File

@ -1113,6 +1113,12 @@ pub mod fsync {
#[cfg(test)]
mod tests {
use i32;
use io;
use result;
use str;
use u64;
use vec;
#[test]
fn test_simple() {

View File

@ -49,9 +49,11 @@ will once again be the preferred module for intertask communication.
use cast;
use either;
use either::Either;
use iter;
use libc;
use libc::size_t;
use ptr;
use result;
use sys;
use task;
use vec;

View File

@ -46,6 +46,8 @@ let unwrapped_msg = match move msg {
use cmp::Eq;
use option;
use ptr;
use str;
use util;
/// The option type

View File

@ -920,6 +920,13 @@ pub fn arch() -> str { ~"arm" }
#[cfg(test)]
#[allow(non_implicitly_copyable_typarams)]
mod tests {
use libc;
use option;
use os;
use rand;
use run;
use str;
use vec;
#[test]
pub fn last_os_error() {

View File

@ -748,7 +748,7 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] {
}
// Various windows helpers, and tests for the impl.
mod windows {
pub mod windows {
use libc;
#[inline(always)]
@ -792,6 +792,9 @@ mod windows {
#[cfg(test)]
mod tests {
use path::windows;
use str;
#[test]
fn test_double_slash_collapsing() {
let path = PosixPath("tmp/");

View File

@ -1246,6 +1246,9 @@ pub mod rt {
#[cfg(test)]
pub mod test {
use pipes::oneshot;
use pipes;
#[test]
pub fn test_select2() {
let (p1, c1) = pipes::stream();

View File

@ -16,13 +16,16 @@
#[doc(hidden)];
use cast;
use iter;
use libc;
use oldcomm;
use option;
use pipes;
use ptr;
use result;
use task;
use task::{TaskBuilder, atomically};
use uint;
extern mod rustrt {
#[legacy_exports];
@ -577,6 +580,12 @@ pub fn unwrap_exclusive<T: Owned>(arc: Exclusive<T>) -> T {
#[cfg(test)]
pub mod tests {
use option;
use pipes;
use result;
use task;
use uint;
#[test]
pub fn exclusive_arc() {
let mut futures = ~[];

View File

@ -17,7 +17,10 @@ use cast;
use cmp::{Eq, Ord};
use libc;
use libc::{c_void, size_t};
use ptr;
use str;
use sys;
use vec;
#[nolink]
#[abi = "cdecl"]

View File

@ -362,6 +362,9 @@ pub fn random() -> uint {
#[cfg(test)]
pub mod tests {
use option::Option;
use rand;
#[test]
pub fn rng_seeded() {
let seed = rand::seed();

View File

@ -381,6 +381,9 @@ pub pure fn unwrap_err<T, U>(res: Result<T, U>) -> U {
#[allow(non_implicitly_copyable_typarams)]
mod tests {
#[legacy_exports];
use result;
fn op1() -> result::Result<int, ~str> { result::Ok(666) }
fn op2(i: int) -> result::Result<uint, ~str> {

View File

@ -418,6 +418,8 @@ pub fn waitpid(pid: pid_t) -> int {
#[cfg(test)]
mod tests {
use io::WriterUtil;
use os;
use run;
// Regression test for memory leaks
#[ignore(cfg(windows))] // FIXME (#2626)

View File

@ -458,6 +458,8 @@ pub mod linear {
#[test]
pub mod test {
use send_map::linear::LinearMap;
use send_map::linear;
use uint;
#[test]
pub fn inserts() {

View File

@ -2307,8 +2307,12 @@ impl &str: StrSlice {
#[cfg(test)]
mod tests {
use char;
use libc::c_char;
use libc;
use ptr;
use str::raw;
use vec;
#[test]
fn test_eq() {

View File

@ -145,6 +145,7 @@ pub pure fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
#[cfg(test)]
pub mod tests {
use cast;
#[test]
pub fn size_of_basic() {

View File

@ -28,6 +28,7 @@ magic.
use rt;
use task::local_data_priv::{local_get, local_pop, local_modify, local_set};
use task;
/**
* Indexes a task-local data slot. The function's code pointer is used for

View File

@ -38,15 +38,21 @@
* ~~~
*/
use cast;
use cmp;
use cmp::Eq;
use iter;
use libc;
use oldcomm;
use option;
use result::Result;
use pipes::{stream, Chan, Port};
use pipes;
use ptr;
use result;
use task::local_data_priv::{local_get, local_set};
use task::rt::{task_id, rust_task};
use task;
use util;
use util::replace;

View File

@ -74,7 +74,9 @@
#[warn(deprecated_mode)];
use cast;
use oldcomm;
use option;
use pipes;
use private;
use ptr;
use send_map;

View File

@ -20,6 +20,7 @@ use from_str::FromStr;
use iter;
use num;
use str;
use uint;
use vec;
pub const bits : uint = inst::bits;

View File

@ -17,6 +17,7 @@ pub use self::inst::{
mod inst {
use sys;
use uint;
pub type T = uint;

View File

@ -2245,6 +2245,8 @@ impl<A:Copy> @[A] : iter::CopyableNonstrictIter<A> {
#[cfg(test)]
mod tests {
use option;
use vec::raw;
fn square(n: uint) -> uint { return n * n; }
@ -2597,7 +2599,9 @@ mod tests {
fn halve(i: &int) -> Option<int> {
if *i % 2 == 0 {
return option::Some::<int>(*i / 2);
} else { return option::None::<int>; }
} else {
return option::None::<int>;
}
}
fn halve_for_sure(i: &int) -> int { return *i / 2; }
let all_even: ~[int] = ~[0, 2, 8, 6];

View File

@ -238,6 +238,10 @@ fn nospan<T: Copy>(t: T) -> ast::spanned<T> {
}
fn path_node(ids: ~[ast::ident]) -> @ast::path {
@{span: dummy_sp(), global: false, idents: ids, rp: None, types: ~[]}
}
fn path_node_global(ids: ~[ast::ident]) -> @ast::path {
@{span: dummy_sp(), global: true, idents: ids, rp: None, types: ~[]}
}
@ -284,8 +288,8 @@ fn mk_path(cx: test_ctxt, path: ~[ast::ident]) -> ~[ast::ident] {
// The ast::Ty of ~[std::test::test_desc]
fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::Ty {
let test_desc_ty_path =
path_node(mk_path(cx, ~[cx.sess.ident_of(~"test"),
cx.sess.ident_of(~"TestDesc")]));
path_node_global(mk_path(cx, ~[cx.sess.ident_of(~"test"),
cx.sess.ident_of(~"TestDesc")]));
let test_desc_ty: ast::Ty =
{id: cx.sess.next_node_id(),
@ -345,7 +349,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
nospan({mutbl: ast::m_imm, ident: cx.sess.ident_of(~"name"),
expr: @name_expr});
let fn_path = path_node(path);
let fn_path = path_node_global(path);
let fn_expr: ast::expr =
{id: cx.sess.next_node_id(),
@ -464,7 +468,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
fn mk_test_main_call(cx: test_ctxt) -> @ast::expr {
// Call os::args to generate the vector of test_descs
let args_path = path_node(~[
let args_path = path_node_global(~[
cx.sess.ident_of(~"os"),
cx.sess.ident_of(~"args")
]);
@ -497,7 +501,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr {
node: test_call_expr_, span: dummy_sp()};
// Call std::test::test_main
let test_main_path = path_node(
let test_main_path = path_node_global(
mk_path(cx, ~[cx.sess.ident_of(~"test"),
cx.sess.ident_of(~"test_main")]));

View File

@ -298,10 +298,10 @@ fn core_macros() -> ~str {
{ $c:ident: $in:ty -> $out:ty; } => {
mod $c {
fn key(_x: @core::condition::Handler<$in,$out>) { }
fn key(_x: @::core::condition::Handler<$in,$out>) { }
pub const cond : core::condition::Condition<$in,$out> =
core::condition::Condition {
pub const cond : ::core::condition::Condition<$in,$out> =
::core::condition::Condition {
name: stringify!(c),
key: key
};