summary refs log tree commit diff
path: root/src/libcore/lib.rs
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2014-06-28 13:57:36 -0700
committerSteven Fackler <sfackler@gmail.com>2014-06-29 15:57:21 -0700
commit1ed646eaf7d09455a086afa11bcd83a7d2a6b0f4 (patch)
tree3c7bc58191bc3b260c4522c115ddf869b986193f /src/libcore/lib.rs
parentff94f867d29a90ab59060c10a62f65994776a8c4 (diff)
downloadrust-1ed646eaf7d09455a086afa11bcd83a7d2a6b0f4.tar.gz
rust-1ed646eaf7d09455a086afa11bcd83a7d2a6b0f4.zip
Extract tests from libcore to a separate crate
Libcore's test infrastructure is complicated by the fact that many lang
items are defined in the crate. The current approach (realcore/realstd
imports) is hacky and hard to work with (tests inside of core::cmp
haven't been run for months!).

Moving tests to a separate crate does mean that they can only test the
public API of libcore, but I don't feel that that is too much of an
issue. The only tests that I had to get rid of were some checking the
various numeric formatters, but those are also exercised through normal
format! calls in other tests.
Diffstat (limited to 'src/libcore/lib.rs')
-rw-r--r--src/libcore/lib.rs29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 4dc45ceeb85..385a33fb92a 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -43,7 +43,9 @@
 //!   the failure message, the file at which failure was invoked, and the line.
 //!   It is up to consumers of this core library to define this failure
 //!   function; it is only required to never return.
-//!
+
+// Since libcore defines many fundamental lang items, all tests live in a
+// separate crate, libcoretest, to avoid bizarre issues.
 
 #![crate_id = "core#0.11.0-pre"]
 #![experimental]
@@ -59,16 +61,6 @@
 #![feature(simd, unsafe_destructor)]
 #![deny(missing_doc)]
 
-#[cfg(test)] extern crate realcore = "core";
-#[cfg(test)] extern crate libc;
-#[cfg(test)] extern crate native;
-#[cfg(test)] extern crate realstd = "std";
-
-#[cfg(test)] pub use cmp = realcore::cmp;
-#[cfg(test)] pub use kinds = realcore::kinds;
-#[cfg(test)] pub use ops = realcore::ops;
-#[cfg(test)] pub use ty = realcore::ty;
-
 mod macros;
 
 #[path = "num/float_macros.rs"] mod float_macros;
@@ -104,10 +96,10 @@ pub mod ptr;
 
 /* Core language traits */
 
-#[cfg(not(test))] pub mod kinds;
-#[cfg(not(test))] pub mod ops;
-#[cfg(not(test))] pub mod ty;
-#[cfg(not(test))] pub mod cmp;
+pub mod kinds;
+pub mod ops;
+pub mod ty;
+pub mod cmp;
 pub mod clone;
 pub mod default;
 pub mod collections;
@@ -144,11 +136,4 @@ mod std {
     pub use kinds;
     pub use option;
     pub use fmt;
-
-    #[cfg(test)] pub use realstd::rt;     // needed for fail!()
-    // #[cfg(test)] pub use realstd::option; // needed for fail!()
-    // #[cfg(test)] pub use realstd::fmt;    // needed for fail!()
-    #[cfg(test)] pub use realstd::os;     // needed for tests
-    #[cfg(test)] pub use realstd::slice;  // needed for tests
-    #[cfg(test)] pub use realstd::vec;    // needed for vec![]
 }