Skip to content

Commit 2371619

Browse files
committed
---
yaml --- r: 113879 b: refs/heads/master c: 104e285 h: refs/heads/master i: 113877: 2ce6de7 113875: a028d77 113871: af4669d v: v3
1 parent cec16b2 commit 2371619

34 files changed

+239
-78
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: f62c121eb0de35ac03a7860e6039202f2522e527
2+
refs/heads/master: 104e285eb8f848867c2666765e2aa8221e8a97d1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ec0258a381b88b5574e3f8ce72ae553ac3a574b7
55
refs/heads/try: 7c6c492fb2af9a85f21ff952942df3523b22fd17

trunk/src/libcore/any.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ mod tests {
150150
use super::*;
151151
use owned::Box;
152152
use str::StrSlice;
153+
use realstd::str::StrAllocating;
153154

154155
#[deriving(Eq, Show)]
155156
struct Test;
@@ -274,13 +275,20 @@ mod tests {
274275

275276
#[test]
276277
fn test_show() {
278+
<<<<<<< HEAD
277279
let a = box 8u as Box<Any>;
278280
let b = box Test as Box<Any>;
279281
assert_eq!(format!("{}", a), "Box<Any>".to_owned());
280282
assert_eq!(format!("{}", b), "Box<Any>".to_owned());
281-
282-
let a = &8u as &Any;
283-
let b = &Test as &Any;
283+
=======
284+
let a = ~8u as ~::realcore::any::Any;
285+
let b = ~Test as ~::realcore::any::Any;
286+
assert_eq!(format!("{}", a), "~Any".to_owned());
287+
assert_eq!(format!("{}", b), "~Any".to_owned());
288+
>>>>>>> core: Get coretest working
289+
290+
let a = &8u as &::realcore::any::Any;
291+
let b = &Test as &::realcore::any::Any;
284292
assert_eq!(format!("{}", a), "&Any".to_owned());
285293
assert_eq!(format!("{}", b), "&Any".to_owned());
286294
}

trunk/src/libcore/bool.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,8 @@ impl Default for bool {
175175

176176
#[cfg(test)]
177177
mod tests {
178-
use prelude::*;
178+
use realstd::prelude::*;
179179
use super::to_bit;
180-
use str::StrSlice;
181180

182181
#[test]
183182
fn test_to_bit() {

trunk/src/libcore/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {
108108
mod tests {
109109
use cast::{bump_box_refcount, transmute};
110110
use raw;
111-
use str::StrSlice;
111+
use realstd::str::StrAllocating;
112112

113113
#[test]
114114
fn test_transmute_copy() {

trunk/src/libcore/cell.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,22 @@ mod test {
221221
#[test]
222222
fn smoketest_cell() {
223223
let x = Cell::new(10);
224-
assert_eq!(x, Cell::new(10));
225-
assert_eq!(x.get(), 10);
224+
assert!(x == Cell::new(10));
225+
assert!(x.get() == 10);
226226
x.set(20);
227-
assert_eq!(x, Cell::new(20));
228-
assert_eq!(x.get(), 20);
227+
assert!(x == Cell::new(20));
228+
assert!(x.get() == 20);
229229

230230
let y = Cell::new((30, 40));
231-
assert_eq!(y, Cell::new((30, 40)));
232-
assert_eq!(y.get(), (30, 40));
231+
assert!(y == Cell::new((30, 40)));
232+
assert!(y.get() == (30, 40));
233233
}
234234

235235
#[test]
236236
fn cell_has_sensible_show() {
237237
use str::StrSlice;
238238

239-
let x = Cell::new("foo bar");
239+
let x = ::realcore::cell::Cell::new("foo bar");
240240
assert!(format!("{}", x).contains(x.get()));
241241

242242
x.set("baz qux");

trunk/src/libcore/char.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ use option::{None, Option, Some};
2929
use iter::{Iterator, range_step};
3030
use unicode::{derived_property, property, general_category, decompose, conversions};
3131

32-
#[cfg(test)] use str::Str;
33-
#[cfg(test)] use strbuf::StrBuf;
34-
#[cfg(test)] use slice::ImmutableVector;
35-
3632
#[cfg(not(test))] use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering};
3733
#[cfg(not(test))] use default::Default;
3834

@@ -682,6 +678,14 @@ impl Default for char {
682678

683679
#[cfg(test)]
684680
mod test {
681+
use super::{escape_unicode, escape_default};
682+
683+
use realcore::char::Char;
684+
use slice::ImmutableVector;
685+
use realstd::option::{Some, None};
686+
use realstd::strbuf::StrBuf;
687+
use realstd::str::StrAllocating;
688+
685689
#[test]
686690
fn test_is_lowercase() {
687691
assert!('a'.is_lowercase());
@@ -822,7 +826,7 @@ mod test {
822826

823827
#[test]
824828
fn test_to_str() {
825-
use to_str::ToStr;
829+
use realstd::to_str::ToStr;
826830
let s = 't'.to_str();
827831
assert_eq!(s, "t".to_owned());
828832
}

trunk/src/libcore/clone.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ extern_fn_clone!(A, B, C, D, E, F, G, H)
128128

129129
#[cfg(test)]
130130
mod test {
131+
use prelude::*;
132+
131133
#[test]
132134
fn test_owned_clone() {
133135
let a = box 5i;

trunk/src/libcore/failure.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
#![allow(dead_code)]
1414

15+
#[cfg(not(test))]
1516
use str::raw::c_str_to_static_slice;
1617

1718
// FIXME: Once std::fmt is in libcore, all of these functions should delegate

trunk/src/libcore/finally.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ use std::unstable::finally::Finally;
3434

3535
use ops::Drop;
3636

37-
#[cfg(test)] use task::failing;
38-
3937
/// A trait for executing a destructor unconditionally after a block of code,
4038
/// regardless of whether the blocked fails.
4139
pub trait Finally<T> {
@@ -119,6 +117,9 @@ impl<'a,A> Drop for Finallyalizer<'a,A> {
119117

120118
#[cfg(test)]
121119
mod test {
120+
use super::{try_finally, Finally};
121+
use realstd::task::failing;
122+
122123
#[test]
123124
fn test_success() {
124125
let mut i = 0;

trunk/src/libcore/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ A quick refresher on memory ordering:
4646

4747
// This is needed to prevent duplicate lang item definitions.
4848
#[cfg(test)]
49-
pub use realstd::intrinsics::{TyDesc, Opaque, TyVisitor, TypeId};
49+
pub use realcore::intrinsics::{TyDesc, Opaque, TyVisitor, TypeId};
5050

5151
pub type GlueFn = extern "Rust" fn(*i8);
5252

trunk/src/libcore/iter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ impl<A, T: Clone + RandomAccessIterator<A>> RandomAccessIterator<A> for Cycle<T>
10901090
pub struct Chain<T, U> {
10911091
a: T,
10921092
b: U,
1093-
flag: bool
1093+
flag: bool,
10941094
}
10951095

10961096
impl<A, T: Iterator<A>, U: Iterator<A>> Iterator<A> for Chain<T, U> {
@@ -2329,13 +2329,13 @@ pub mod order {
23292329

23302330
#[cfg(test)]
23312331
mod tests {
2332-
use super::*;
2333-
use prelude::*;
2332+
use realstd::prelude::*;
2333+
use realstd::iter::*;
2334+
use realstd::num;
23342335

23352336
use cmp;
23362337
use owned::Box;
23372338
use uint;
2338-
use num;
23392339

23402340
#[test]
23412341
fn test_counter_from_iter() {

trunk/src/libcore/lib.rs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,21 @@
1818
html_root_url = "http://static.rust-lang.org/doc/master")]
1919

2020
#![no_std]
21-
#![feature(globs, macro_rules, managed_boxes)]
21+
#![feature(globs, macro_rules, managed_boxes, phase)]
2222
#![deny(missing_doc)]
2323

24+
#[cfg(test)] extern crate realcore = "core";
25+
#[cfg(test)] extern crate libc;
26+
#[cfg(test)] extern crate native;
27+
#[phase(syntax, link)] #[cfg(test)] extern crate realstd = "std";
28+
#[phase(syntax, link)] #[cfg(test)] extern crate log;
29+
30+
#[cfg(test)] pub use kinds = realcore::kinds;
31+
#[cfg(test)] pub use cmp = realcore::cmp;
32+
#[cfg(test)] pub use ops = realcore::ops;
33+
#[cfg(test)] pub use ty = realcore::ty;
34+
35+
#[cfg(not(test))]
2436
mod macros;
2537

2638
#[path = "num/float_macros.rs"] mod float_macros;
@@ -44,6 +56,10 @@ mod macros;
4456

4557
pub mod num;
4658

59+
/* The libcore prelude, not as all-encompassing as the libstd prelude */
60+
61+
pub mod prelude;
62+
4763
/* Core modules for ownership management */
4864

4965
pub mod cast;
@@ -53,10 +69,10 @@ pub mod ptr;
5369

5470
/* Core language traits */
5571

56-
pub mod cmp;
57-
pub mod kinds;
58-
pub mod ops;
59-
pub mod ty;
72+
#[cfg(not(test))] pub mod kinds;
73+
#[cfg(not(test))] pub mod ops;
74+
#[cfg(not(test))] pub mod ty;
75+
#[cfg(not(test))] pub mod cmp;
6076
pub mod clone;
6177
pub mod default;
6278
pub mod container;
@@ -88,4 +104,9 @@ mod should_not_exist;
88104
mod std {
89105
pub use clone;
90106
pub use cmp;
107+
108+
#[cfg(test)] pub use realstd::fmt; // needed for fail!()
109+
#[cfg(test)] pub use realstd::rt; // needed for fail!()
110+
#[cfg(test)] pub use realstd::option; // needed for assert!()
111+
#[cfg(test)] pub use realstd::os; // needed for tests
91112
}

trunk/src/libcore/mem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ pub fn drop<T>(_x: T) { }
293293
mod tests {
294294
use mem::*;
295295
use option::{Some,None};
296-
use str::StrSlice;
296+
use realstd::str::StrAllocating;
297297

298298
#[test]
299299
fn size_of_basic() {

trunk/src/libcore/num/f32.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010

1111
//! Operations and constants for 32-bits floats (`f32` type)
1212
13-
use cmp::{Eq, Ord};
1413
use default::Default;
1514
use intrinsics;
1615
use num::{Zero, One, Bounded, Signed, Num, Primitive};
17-
use ops::{Add, Sub, Mul, Div, Rem, Neg};
16+
17+
#[cfg(not(test))] use cmp::{Eq, Ord};
18+
#[cfg(not(test))] use ops::{Add, Sub, Mul, Div, Rem, Neg};
1819

1920
pub static RADIX: uint = 2u;
2021

@@ -100,6 +101,7 @@ pub mod consts {
100101
pub static LN_10: f32 = 2.30258509299404568401799145468436421_f32;
101102
}
102103

104+
#[cfg(not(test))]
103105
impl Ord for f32 {
104106
#[inline]
105107
fn lt(&self, other: &f32) -> bool { (*self) < (*other) }
@@ -110,6 +112,7 @@ impl Ord for f32 {
110112
#[inline]
111113
fn gt(&self, other: &f32) -> bool { (*self) > (*other) }
112114
}
115+
#[cfg(not(test))]
113116
impl Eq for f32 {
114117
#[inline]
115118
fn eq(&self, other: &f32) -> bool { (*self) == (*other) }

trunk/src/libcore/num/f64.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010

1111
//! Operations and constants for 64-bits floats (`f64` type)
1212
13-
use cmp::{Eq, Ord};
1413
use default::Default;
1514
use intrinsics;
1615
use num::{Zero, One, Bounded, Signed, Num, Primitive};
17-
use ops::{Add, Sub, Mul, Div, Rem, Neg};
16+
17+
#[cfg(not(test))] use cmp::{Eq, Ord};
18+
#[cfg(not(test))] use ops::{Add, Sub, Mul, Div, Rem, Neg};
1819

1920
// FIXME(#5527): These constants should be deprecated once associated
2021
// constants are implemented in favour of referencing the respective
@@ -106,6 +107,7 @@ pub mod consts {
106107
pub static LN_10: f64 = 2.30258509299404568401799145468436421_f64;
107108
}
108109

110+
#[cfg(not(test))]
109111
impl Ord for f64 {
110112
#[inline]
111113
fn lt(&self, other: &f64) -> bool { (*self) < (*other) }
@@ -116,6 +118,7 @@ impl Ord for f64 {
116118
#[inline]
117119
fn gt(&self, other: &f64) -> bool { (*self) > (*other) }
118120
}
121+
#[cfg(not(test))]
119122
impl Eq for f64 {
120123
#[inline]
121124
fn eq(&self, other: &f64) -> bool { (*self) == (*other) }

trunk/src/libcore/num/i16.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010

1111
//! Operations and constants for signed 16-bits integers (`i16` type)
1212
13-
use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
1413
use default::Default;
1514
use intrinsics;
1615
use num::{Bitwise, Bounded, Zero, One, Signed, Num, Primitive, Int};
1716
use num::{CheckedDiv, CheckedAdd, CheckedSub, CheckedMul};
17+
use option::{Option, Some, None};
18+
19+
#[cfg(not(test))]
20+
use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
21+
#[cfg(not(test))]
1822
use ops::{Add, Sub, Mul, Div, Rem, Neg, BitOr, BitAnd, BitXor};
23+
#[cfg(not(test))]
1924
use ops::{Shl, Shr, Not};
20-
use option::{Option, Some, None};
2125

2226
int_module!(i16, 16)
2327

trunk/src/libcore/num/i32.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010

1111
//! Operations and constants for signed 32-bits integers (`i32` type)
1212
13-
use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
1413
use default::Default;
1514
use intrinsics;
1615
use num::{Bitwise, Bounded, Zero, One, Signed, Num, Primitive, Int};
1716
use num::{CheckedDiv, CheckedAdd, CheckedSub, CheckedMul};
17+
use option::{Option, Some, None};
18+
19+
#[cfg(not(test))]
20+
use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
21+
#[cfg(not(test))]
1822
use ops::{Add, Sub, Mul, Div, Rem, Neg, BitOr, BitAnd, BitXor};
23+
#[cfg(not(test))]
1924
use ops::{Shl, Shr, Not};
20-
use option::{Option, Some, None};
2125

2226
int_module!(i32, 32)
2327

trunk/src/libcore/num/i64.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010

1111
//! Operations and constants for signed 64-bits integers (`i64` type)
1212
13-
use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
1413
use default::Default;
1514
use intrinsics;
1615
use num::{Bitwise, Bounded, Zero, One, Signed, Num, Primitive, Int};
1716
use num::{CheckedDiv, CheckedAdd, CheckedSub, CheckedMul};
17+
use option::{Option, Some, None};
18+
19+
#[cfg(not(test))]
20+
use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
21+
#[cfg(not(test))]
1822
use ops::{Add, Sub, Mul, Div, Rem, Neg, BitOr, BitAnd, BitXor};
23+
#[cfg(not(test))]
1924
use ops::{Shl, Shr, Not};
20-
use option::{Option, Some, None};
2125

2226
int_module!(i64, 64)
2327

0 commit comments

Comments
 (0)