Skip to content

Commit 104e285

Browse files
committed
core: Get coretest working
This mostly involved frobbing imports between realstd, realcore, and the core being test. Some of the imports are a little counterintuitive, but it mainly focuses around libcore's types not implementing Show while libstd's types implement Show.
1 parent f62c121 commit 104e285

33 files changed

+238
-77
lines changed

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
}

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() {

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() {

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");

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
}

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;

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

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;

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

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() {

0 commit comments

Comments
 (0)