提交 e26ca35b 编写于 作者: P Patrick Walton

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

上级 84ce55e5
......@@ -16,6 +16,7 @@
//! Boolean logic
use bool;
use cmp;
use cmp::Eq;
......
......@@ -14,6 +14,7 @@
#[forbid(deprecated_mode)];
#[forbid(deprecated_pattern)];
use char;
use cmp::Eq;
use str;
use u32;
......
......@@ -473,6 +473,10 @@ fn pop_tail() -> Option<T> { self.pop_tail_n().map (|nobe| nobe.data) }
#[cfg(test)]
mod tests {
#[legacy_exports];
use iter;
use vec;
#[test]
fn test_dlist_concat() {
let a = from_vec(~[1,2]);
......
......@@ -21,6 +21,7 @@
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)));
......
......@@ -27,6 +27,7 @@
use m_float = f64;
use cmp::{Eq, Ord};
use cmp;
use f64;
use num;
use num::Num::from_int;
......
......@@ -16,6 +16,7 @@
use char;
use cmp::{Eq, Ord};
use cmp;
use from_str::FromStr;
use iter;
use num;
......
......@@ -1113,6 +1113,12 @@ pub fn obj_sync(o: FSyncable, opt_level: Option<Level>,
#[cfg(test)]
mod tests {
use i32;
use io;
use result;
use str;
use u64;
use vec;
#[test]
fn test_simple() {
......
......@@ -49,9 +49,11 @@
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;
......
......@@ -46,6 +46,8 @@
use cmp::Eq;
use option;
use ptr;
use str;
use util;
/// The option type
......
......@@ -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() {
......
......@@ -748,7 +748,7 @@ impl WindowsPath : GenericPath {
}
// 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/");
......
......@@ -1246,6 +1246,9 @@ pub fn make_none<T>() -> Option<T> { None }
#[cfg(test)]
pub mod test {
use pipes::oneshot;
use pipes;
#[test]
pub fn test_select2() {
let (p1, c1) = pipes::stream();
......
......@@ -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 = ~[];
......
......@@ -17,7 +17,10 @@
use cmp::{Eq, Ord};
use libc;
use libc::{c_void, size_t};
use ptr;
use str;
use sys;
use vec;
#[nolink]
#[abi = "cdecl"]
......
......@@ -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();
......
......@@ -381,6 +381,9 @@ pub fn iter_vec2<S,T,U:Copy>(ss: &[S], ts: &[T],
#[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> {
......
......@@ -418,6 +418,8 @@ fn WEXITSTATUS(status: i32) -> i32 {
#[cfg(test)]
mod tests {
use io::WriterUtil;
use os;
use run;
// Regression test for memory leaks
#[ignore(cfg(windows))] // FIXME (#2626)
......
......@@ -458,6 +458,8 @@ impl<K:Hash IterBytes Eq, V: Eq> LinearMap<K, V>: cmp::Eq {
#[test]
pub mod test {
use send_map::linear::LinearMap;
use send_map::linear;
use uint;
#[test]
pub fn inserts() {
......
......@@ -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() {
......
......@@ -145,6 +145,7 @@ pub struct Closure {
#[cfg(test)]
pub mod tests {
use cast;
#[test]
pub fn size_of_basic() {
......
......@@ -28,6 +28,7 @@
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
......
......@@ -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;
......
......@@ -74,7 +74,9 @@
#[warn(deprecated_mode)];
use cast;
use oldcomm;
use option;
use pipes;
use private;
use ptr;
use send_map;
......
......@@ -20,6 +20,7 @@
use iter;
use num;
use str;
use uint;
use vec;
pub const bits : uint = inst::bits;
......
......@@ -17,6 +17,7 @@
mod inst {
use sys;
use uint;
pub type T = uint;
......
......@@ -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 @@ fn test_filter_map() {
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];
......
......@@ -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")]));
......
......@@ -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
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册