Skip to content

Commit e26ca35

Browse files
committed
librustc: Fix the test runner, the condition system, and core test. rs=bustage
1 parent 84ce55e commit e26ca35

28 files changed

+91
-13
lines changed

src/libcore/bool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
//! Boolean logic
1818
19+
use bool;
1920
use cmp;
2021
use cmp::Eq;
2122

src/libcore/char.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#[forbid(deprecated_mode)];
1515
#[forbid(deprecated_pattern)];
1616

17+
use char;
1718
use cmp::Eq;
1819
use str;
1920
use u32;

src/libcore/dlist.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,10 @@ impl<T: Copy> DList<T> {
473473
#[cfg(test)]
474474
mod tests {
475475
#[legacy_exports];
476+
477+
use iter;
478+
use vec;
479+
476480
#[test]
477481
fn test_dlist_concat() {
478482
let a = from_vec(~[1,2]);

src/libcore/flate.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Simple compression
2121
use libc;
2222
use libc::{c_void, size_t, c_int};
2323
use ptr;
24+
use rand;
2425
use vec;
2526

2627
extern mod rustrt {
@@ -91,8 +92,8 @@ fn test_flate_round_trip() {
9192
}
9293
debug!("de/inflate of %u bytes of random word-sequences",
9394
in.len());
94-
let cmp = flate::deflate_bytes(in);
95-
let out = flate::inflate_bytes(cmp);
95+
let cmp = deflate_bytes(in);
96+
let out = inflate_bytes(cmp);
9697
debug!("%u bytes deflated to %u (%.1f%% size)",
9798
in.len(), cmp.len(),
9899
100.0 * ((cmp.len() as float) / (in.len() as float)));

src/libcore/float.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use m_float = f64;
2828

2929
use cmp::{Eq, Ord};
30+
use cmp;
3031
use f64;
3132
use num;
3233
use num::Num::from_int;

src/libcore/int-template.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use T = self::inst::T;
1616

1717
use char;
1818
use cmp::{Eq, Ord};
19+
use cmp;
1920
use from_str::FromStr;
2021
use iter;
2122
use num;

src/libcore/io.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,12 @@ pub mod fsync {
11131113

11141114
#[cfg(test)]
11151115
mod tests {
1116+
use i32;
1117+
use io;
1118+
use result;
1119+
use str;
1120+
use u64;
1121+
use vec;
11161122

11171123
#[test]
11181124
fn test_simple() {

src/libcore/oldcomm.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ will once again be the preferred module for intertask communication.
4949
use cast;
5050
use either;
5151
use either::Either;
52+
use iter;
5253
use libc;
5354
use libc::size_t;
5455
use ptr;
56+
use result;
5557
use sys;
5658
use task;
5759
use vec;

src/libcore/option.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ let unwrapped_msg = match move msg {
4646

4747
use cmp::Eq;
4848
use option;
49+
use ptr;
50+
use str;
4951
use util;
5052

5153
/// The option type

src/libcore/os.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,13 @@ pub fn arch() -> str { ~"arm" }
920920
#[cfg(test)]
921921
#[allow(non_implicitly_copyable_typarams)]
922922
mod tests {
923+
use libc;
924+
use option;
925+
use os;
926+
use rand;
927+
use run;
928+
use str;
929+
use vec;
923930

924931
#[test]
925932
pub fn last_os_error() {

src/libcore/path.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] {
748748
}
749749
750750
// Various windows helpers, and tests for the impl.
751-
mod windows {
751+
pub mod windows {
752752
use libc;
753753
754754
#[inline(always)]
@@ -792,6 +792,9 @@ mod windows {
792792

793793
#[cfg(test)]
794794
mod tests {
795+
use path::windows;
796+
use str;
797+
795798
#[test]
796799
fn test_double_slash_collapsing() {
797800
let path = PosixPath("tmp/");

src/libcore/pipes.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,9 @@ pub mod rt {
12461246

12471247
#[cfg(test)]
12481248
pub mod test {
1249+
use pipes::oneshot;
1250+
use pipes;
1251+
12491252
#[test]
12501253
pub fn test_select2() {
12511254
let (p1, c1) = pipes::stream();

src/libcore/private.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616
#[doc(hidden)];
1717

1818
use cast;
19+
use iter;
1920
use libc;
2021
use oldcomm;
2122
use option;
2223
use pipes;
2324
use ptr;
25+
use result;
2426
use task;
2527
use task::{TaskBuilder, atomically};
28+
use uint;
2629

2730
extern mod rustrt {
2831
#[legacy_exports];
@@ -577,6 +580,12 @@ pub fn unwrap_exclusive<T: Owned>(arc: Exclusive<T>) -> T {
577580

578581
#[cfg(test)]
579582
pub mod tests {
583+
use option;
584+
use pipes;
585+
use result;
586+
use task;
587+
use uint;
588+
580589
#[test]
581590
pub fn exclusive_arc() {
582591
let mut futures = ~[];

src/libcore/ptr.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ use cast;
1717
use cmp::{Eq, Ord};
1818
use libc;
1919
use libc::{c_void, size_t};
20+
use ptr;
21+
use str;
2022
use sys;
23+
use vec;
2124

2225
#[nolink]
2326
#[abi = "cdecl"]

src/libcore/rand.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ pub fn random() -> uint {
362362

363363
#[cfg(test)]
364364
pub mod tests {
365+
use option::Option;
366+
use rand;
367+
365368
#[test]
366369
pub fn rng_seeded() {
367370
let seed = rand::seed();

src/libcore/result.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ pub pure fn unwrap_err<T, U>(res: Result<T, U>) -> U {
381381
#[allow(non_implicitly_copyable_typarams)]
382382
mod tests {
383383
#[legacy_exports];
384+
385+
use result;
386+
384387
fn op1() -> result::Result<int, ~str> { result::Ok(666) }
385388

386389
fn op2(i: int) -> result::Result<uint, ~str> {

src/libcore/run.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ pub fn waitpid(pid: pid_t) -> int {
418418
#[cfg(test)]
419419
mod tests {
420420
use io::WriterUtil;
421+
use os;
422+
use run;
421423

422424
// Regression test for memory leaks
423425
#[ignore(cfg(windows))] // FIXME (#2626)

src/libcore/send_map.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ pub mod linear {
458458
#[test]
459459
pub mod test {
460460
use send_map::linear::LinearMap;
461+
use send_map::linear;
462+
use uint;
461463

462464
#[test]
463465
pub fn inserts() {

src/libcore/str.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2307,8 +2307,12 @@ impl &str: StrSlice {
23072307

23082308
#[cfg(test)]
23092309
mod tests {
2310-
2310+
use char;
23112311
use libc::c_char;
2312+
use libc;
2313+
use ptr;
2314+
use str::raw;
2315+
use vec;
23122316

23132317
#[test]
23142318
fn test_eq() {

src/libcore/sys.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ pub pure fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
145145

146146
#[cfg(test)]
147147
pub mod tests {
148+
use cast;
148149

149150
#[test]
150151
pub fn size_of_basic() {

src/libcore/task/local_data.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ magic.
2828

2929
use rt;
3030
use task::local_data_priv::{local_get, local_pop, local_modify, local_set};
31+
use task;
3132

3233
/**
3334
* Indexes a task-local data slot. The function's code pointer is used for

src/libcore/task/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,21 @@
3838
* ~~~
3939
*/
4040

41+
use cast;
4142
use cmp;
4243
use cmp::Eq;
44+
use iter;
45+
use libc;
4346
use oldcomm;
4447
use option;
4548
use result::Result;
4649
use pipes::{stream, Chan, Port};
50+
use pipes;
51+
use ptr;
4752
use result;
4853
use task::local_data_priv::{local_get, local_set};
4954
use task::rt::{task_id, rust_task};
55+
use task;
5056
use util;
5157
use util::replace;
5258

src/libcore/task/spawn.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@
7474
#[warn(deprecated_mode)];
7575

7676
use cast;
77+
use oldcomm;
7778
use option;
79+
use pipes;
7880
use private;
7981
use ptr;
8082
use send_map;

src/libcore/uint-template.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use from_str::FromStr;
2020
use iter;
2121
use num;
2222
use str;
23+
use uint;
2324
use vec;
2425

2526
pub const bits : uint = inst::bits;

src/libcore/uint-template/uint.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub use self::inst::{
1717

1818
mod inst {
1919
use sys;
20+
use uint;
2021

2122
pub type T = uint;
2223

src/libcore/vec.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,8 @@ impl<A:Copy> @[A] : iter::CopyableNonstrictIter<A> {
22452245

22462246
#[cfg(test)]
22472247
mod tests {
2248+
use option;
2249+
use vec::raw;
22482250

22492251
fn square(n: uint) -> uint { return n * n; }
22502252

@@ -2597,7 +2599,9 @@ mod tests {
25972599
fn halve(i: &int) -> Option<int> {
25982600
if *i % 2 == 0 {
25992601
return option::Some::<int>(*i / 2);
2600-
} else { return option::None::<int>; }
2602+
} else {
2603+
return option::None::<int>;
2604+
}
26012605
}
26022606
fn halve_for_sure(i: &int) -> int { return *i / 2; }
26032607
let all_even: ~[int] = ~[0, 2, 8, 6];

src/librustc/front/test.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ fn nospan<T: Copy>(t: T) -> ast::spanned<T> {
238238
}
239239

240240
fn path_node(ids: ~[ast::ident]) -> @ast::path {
241+
@{span: dummy_sp(), global: false, idents: ids, rp: None, types: ~[]}
242+
}
243+
244+
fn path_node_global(ids: ~[ast::ident]) -> @ast::path {
241245
@{span: dummy_sp(), global: true, idents: ids, rp: None, types: ~[]}
242246
}
243247

@@ -284,8 +288,8 @@ fn mk_path(cx: test_ctxt, path: ~[ast::ident]) -> ~[ast::ident] {
284288
// The ast::Ty of ~[std::test::test_desc]
285289
fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::Ty {
286290
let test_desc_ty_path =
287-
path_node(mk_path(cx, ~[cx.sess.ident_of(~"test"),
288-
cx.sess.ident_of(~"TestDesc")]));
291+
path_node_global(mk_path(cx, ~[cx.sess.ident_of(~"test"),
292+
cx.sess.ident_of(~"TestDesc")]));
289293

290294
let test_desc_ty: ast::Ty =
291295
{id: cx.sess.next_node_id(),
@@ -345,7 +349,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
345349
nospan({mutbl: ast::m_imm, ident: cx.sess.ident_of(~"name"),
346350
expr: @name_expr});
347351

348-
let fn_path = path_node(path);
352+
let fn_path = path_node_global(path);
349353

350354
let fn_expr: ast::expr =
351355
{id: cx.sess.next_node_id(),
@@ -464,7 +468,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
464468

465469
fn mk_test_main_call(cx: test_ctxt) -> @ast::expr {
466470
// Call os::args to generate the vector of test_descs
467-
let args_path = path_node(~[
471+
let args_path = path_node_global(~[
468472
cx.sess.ident_of(~"os"),
469473
cx.sess.ident_of(~"args")
470474
]);
@@ -497,7 +501,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr {
497501
node: test_call_expr_, span: dummy_sp()};
498502

499503
// Call std::test::test_main
500-
let test_main_path = path_node(
504+
let test_main_path = path_node_global(
501505
mk_path(cx, ~[cx.sess.ident_of(~"test"),
502506
cx.sess.ident_of(~"test_main")]));
503507

src/libsyntax/ext/expand.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ fn core_macros() -> ~str {
298298
{ $c:ident: $in:ty -> $out:ty; } => {
299299

300300
mod $c {
301-
fn key(_x: @core::condition::Handler<$in,$out>) { }
301+
fn key(_x: @::core::condition::Handler<$in,$out>) { }
302302

303-
pub const cond : core::condition::Condition<$in,$out> =
304-
core::condition::Condition {
303+
pub const cond : ::core::condition::Condition<$in,$out> =
304+
::core::condition::Condition {
305305
name: stringify!(c),
306306
key: key
307307
};

0 commit comments

Comments
 (0)