diff options
| -rw-r--r-- | src/libextra/dlist.rs | 64 | ||||
| -rw-r--r-- | src/libextra/json.rs | 3 | ||||
| -rw-r--r-- | src/libextra/lib.rs | 10 | ||||
| -rw-r--r-- | src/libextra/num/bigint.rs | 2 | ||||
| -rw-r--r-- | src/libextra/ringbuf.rs | 5 | ||||
| -rw-r--r-- | src/libextra/stats.rs | 2 | ||||
| -rw-r--r-- | src/libstd/unstable/stack.rs | 3 |
7 files changed, 41 insertions, 48 deletions
diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs index c91f9326644..85def62dc3b 100644 --- a/src/libextra/dlist.rs +++ b/src/libextra/dlist.rs @@ -625,43 +625,43 @@ impl<A: Clone> Clone for DList<A> { } #[cfg(test)] -pub fn check_links<T>(list: &DList<T>) { - let mut len = 0u; - let mut last_ptr: Option<&Node<T>> = None; - let mut node_ptr: &Node<T>; - match list.list_head { - None => { assert_eq!(0u, list.length); return } - Some(ref node) => node_ptr = &**node, - } - loop { - match (last_ptr, node_ptr.prev.resolve_immut()) { - (None , None ) => {} - (None , _ ) => fail!("prev link for list_head"), - (Some(p), Some(pptr)) => { - assert_eq!(p as *Node<T>, pptr as *Node<T>); - } - _ => fail!("prev link is none, not good"), +mod tests { + use container::Deque; + use extra::test; + use std::rand; + use super::{DList, Node, ListInsertion}; + + pub fn check_links<T>(list: &DList<T>) { + let mut len = 0u; + let mut last_ptr: Option<&Node<T>> = None; + let mut node_ptr: &Node<T>; + match list.list_head { + None => { assert_eq!(0u, list.length); return } + Some(ref node) => node_ptr = &**node, } - match node_ptr.next { - Some(ref next) => { - last_ptr = Some(node_ptr); - node_ptr = &**next; - len += 1; + loop { + match (last_ptr, node_ptr.prev.resolve_immut()) { + (None , None ) => {} + (None , _ ) => fail!("prev link for list_head"), + (Some(p), Some(pptr)) => { + assert_eq!(p as *Node<T>, pptr as *Node<T>); + } + _ => fail!("prev link is none, not good"), } - None => { - len += 1; - break; + match node_ptr.next { + Some(ref next) => { + last_ptr = Some(node_ptr); + node_ptr = &**next; + len += 1; + } + None => { + len += 1; + break; + } } } + assert_eq!(len, list.length); } - assert_eq!(len, list.length); -} - -#[cfg(test)] -mod tests { - use super::*; - use std::rand; - use extra::test; #[test] fn test_basic() { diff --git a/src/libextra/json.rs b/src/libextra/json.rs index aa2cc9c855e..748d751a2df 100644 --- a/src/libextra/json.rs +++ b/src/libextra/json.rs @@ -1333,11 +1333,10 @@ impl to_str::ToStr for Error { #[cfg(test)] mod tests { - use super::*; use std::io; - use serialize::Decodable; + use serialize::{Encodable, Decodable}; use treemap::TreeMap; #[deriving(Eq, Encodable, Decodable)] diff --git a/src/libextra/lib.rs b/src/libextra/lib.rs index 28e426d1ccf..44b01caac26 100644 --- a/src/libextra/lib.rs +++ b/src/libextra/lib.rs @@ -34,8 +34,6 @@ Rust extras are part of the standard Rust distribution. #[deny(non_camel_case_types)]; #[deny(missing_doc)]; -pub use std::os; - // Utility modules pub mod c_vec; @@ -106,12 +104,4 @@ pub mod serialize; pub mod extra { pub use serialize; pub use test; - - // For bootstrapping. - pub use std::clone; - pub use std::condition; - pub use std::cmp; - pub use std::unstable; - pub use std::str; - pub use std::os; } diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index 2d87c6b0073..ed731298b52 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -1434,6 +1434,7 @@ impl BigInt { #[cfg(test)] mod biguint_tests { use super::*; + use super::RandBigInt; use std::cmp::{Less, Equal, Greater}; use std::i64; @@ -2090,6 +2091,7 @@ mod biguint_tests { #[cfg(test)] mod bigint_tests { use super::*; + use super::RandBigInt; use std::cmp::{Less, Equal, Greater}; use std::i64; diff --git a/src/libextra/ringbuf.rs b/src/libextra/ringbuf.rs index 19e293c94a2..da49f2372f4 100644 --- a/src/libextra/ringbuf.rs +++ b/src/libextra/ringbuf.rs @@ -404,10 +404,11 @@ impl<A> Extendable<A> for RingBuf<A> { #[cfg(test)] mod tests { - use super::*; + use container::Deque; + use extra::test; use std::clone::Clone; use std::cmp::Eq; - use extra::test; + use super::RingBuf; #[test] fn test_simple() { diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs index 5f3700fec07..f95c12904ff 100644 --- a/src/libextra/stats.rs +++ b/src/libextra/stats.rs @@ -432,7 +432,6 @@ pub fn freq_count<T: Iterator<U>, U: Eq+Hash>(mut iter: T) -> hashmap::HashMap<U #[cfg(test)] mod tests { - use stats::Stats; use stats::Summary; use stats::write_5_number_summary; @@ -1018,6 +1017,7 @@ mod tests { mod bench { use extra::test::BenchHarness; use std::vec; + use stats::Stats; #[bench] fn sum_three_items(bh: &mut BenchHarness) { diff --git a/src/libstd/unstable/stack.rs b/src/libstd/unstable/stack.rs index d6cd690eaa9..66a9d18aaec 100644 --- a/src/libstd/unstable/stack.rs +++ b/src/libstd/unstable/stack.rs @@ -36,9 +36,10 @@ static RED_ZONE: uint = 20 * 1024; // irrelevant for documentation purposes. #[cfg(not(test))] // in testing, use the original libstd's version pub extern "C" fn rust_stack_exhausted() { - use rt::task::Task; use option::None; use rt::local::Local; + use rt::task::Task; + use str::Str; use unstable::intrinsics; unsafe { |
