about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-05-21 17:24:31 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-05-22 21:57:10 -0700
commitee52865c8848657e737e3c2071728b062ec9c8de (patch)
tree885518283fff1b22a383bd8193a9fd4feea26515
parent1be40be613177d4849f42da284a3af74e1d58da2 (diff)
test: Update tests and import the prelude in some more places.
-rw-r--r--src/libextra/arc.rs1
-rw-r--r--src/libextra/dlist.rs2
-rw-r--r--src/libextra/fileinput.rs2
-rw-r--r--src/libextra/flatpipes.rs2
-rw-r--r--src/libextra/json.rs2
-rw-r--r--src/libextra/net_tcp.rs2
-rw-r--r--src/libextra/num/bigint.rs4
-rw-r--r--src/libextra/num/rational.rs2
-rw-r--r--src/libextra/priority_queue.rs24
-rw-r--r--src/libextra/smallintmap.rs2
-rw-r--r--src/libextra/sort.rs9
-rw-r--r--src/libextra/std.rc2
-rw-r--r--src/libextra/sync.rs1
-rw-r--r--src/libextra/tempfile.rs2
-rw-r--r--src/libextra/timer.rs2
-rw-r--r--src/libextra/treemap.rs3
-rw-r--r--src/libextra/uv_ll.rs1
-rw-r--r--src/test/auxiliary/extern-crosscrate-source.rs4
-rw-r--r--src/test/run-pass/const-cast.rs2
-rw-r--r--src/test/run-pass/const-cross-crate-extern.rs2
-rw-r--r--src/test/run-pass/const-extern-function.rs2
-rw-r--r--src/test/run-pass/extern-call-deep.rs4
-rw-r--r--src/test/run-pass/extern-call-deep2.rs4
-rw-r--r--src/test/run-pass/extern-call-scrub.rs4
-rw-r--r--src/test/run-pass/extern-call.rs4
-rw-r--r--src/test/run-pass/extern-stress.rs4
-rw-r--r--src/test/run-pass/extern-take-value.rs8
-rw-r--r--src/test/run-pass/extern-yield.rs4
-rw-r--r--src/test/run-pass/foreign-call-no-runtime.rs4
29 files changed, 66 insertions, 43 deletions
diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs
index 087b28ec01e..648089a5524 100644
--- a/src/libextra/arc.rs
+++ b/src/libextra/arc.rs
@@ -511,6 +511,7 @@ pub impl<'self, T:Const + Owned> RWReadMode<'self, T> {
 
 #[cfg(test)]
 mod tests {
+    use core::prelude::*;
 
     use arc::*;
     use arc;
diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs
index c3ef1f25ad9..75249b9f467 100644
--- a/src/libextra/dlist.rs
+++ b/src/libextra/dlist.rs
@@ -534,6 +534,8 @@ impl<T> BaseIter<T> for @mut DList<T> {
 
 #[cfg(test)]
 mod tests {
+    use core::prelude::*;
+
     use super::*;
 
     #[test]
diff --git a/src/libextra/fileinput.rs b/src/libextra/fileinput.rs
index a9024592426..ec2c73251ba 100644
--- a/src/libextra/fileinput.rs
+++ b/src/libextra/fileinput.rs
@@ -405,6 +405,8 @@ pub fn input_vec_state(files: ~[Option<Path>],
 
 #[cfg(test)]
 mod test {
+    use core::prelude::*;
+
     use core::io::WriterUtil;
     use super::{FileInput, pathify, input_vec, input_vec_state};
 
diff --git a/src/libextra/flatpipes.rs b/src/libextra/flatpipes.rs
index 7c97cabd589..76361db7d76 100644
--- a/src/libextra/flatpipes.rs
+++ b/src/libextra/flatpipes.rs
@@ -866,6 +866,8 @@ mod test {
     // Tests that the different backends behave the same when the
     // binary streaming protocol is broken
     mod broken_protocol {
+        use core::prelude::*;
+
         use flatpipes::{BytePort, FlatPort};
         use flatpipes::flatteners::PodUnflattener;
         use flatpipes::pod;
diff --git a/src/libextra/json.rs b/src/libextra/json.rs
index f56da368008..6656c896e74 100644
--- a/src/libextra/json.rs
+++ b/src/libextra/json.rs
@@ -1327,6 +1327,8 @@ impl to_str::ToStr for Error {
 
 #[cfg(test)]
 mod tests {
+    use core::prelude::*;
+
     use super::*;
 
     use core::hashmap::HashMap;
diff --git a/src/libextra/net_tcp.rs b/src/libextra/net_tcp.rs
index d0a1385b706..894488e47e1 100644
--- a/src/libextra/net_tcp.rs
+++ b/src/libextra/net_tcp.rs
@@ -1440,6 +1440,8 @@ struct TcpBufferedSocketData {
 
 #[cfg(test)]
 mod test {
+    use core::prelude::*;
+
     use net::ip;
     use net::tcp::{GenericListenErr, TcpConnectErrData, TcpListenErrData};
     use net::tcp::{connect, accept, read, listen, TcpSocket, socket_buf};
diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs
index fa7621462ef..776172262b7 100644
--- a/src/libextra/num/bigint.rs
+++ b/src/libextra/num/bigint.rs
@@ -1145,6 +1145,8 @@ pub impl BigInt {
 
 #[cfg(test)]
 mod biguint_tests {
+    use core::prelude::*;
+
     use super::*;
     use core::num::{IntConvertible, Zero, One, FromStrRadix};
     use core::cmp::{Less, Equal, Greater};
@@ -1611,6 +1613,8 @@ mod biguint_tests {
 
 #[cfg(test)]
 mod bigint_tests {
+    use core::prelude::*;
+
     use super::*;
     use core::cmp::{Less, Equal, Greater};
     use core::num::{IntConvertible, Zero, One, FromStrRadix};
diff --git a/src/libextra/num/rational.rs b/src/libextra/num/rational.rs
index d26ef06ebce..de114a35e36 100644
--- a/src/libextra/num/rational.rs
+++ b/src/libextra/num/rational.rs
@@ -284,6 +284,8 @@ impl<T: FromStrRadix + Clone + Integer + Ord>
 
 #[cfg(test)]
 mod test {
+    use core::prelude::*;
+
     use super::*;
     use core::num::{Zero,One,FromStrRadix,IntConvertible};
     use core::from_str::FromStr;
diff --git a/src/libextra/priority_queue.rs b/src/libextra/priority_queue.rs
index 6d41cd653eb..a4fc30cedcd 100644
--- a/src/libextra/priority_queue.rs
+++ b/src/libextra/priority_queue.rs
@@ -185,13 +185,13 @@ pub impl <T:Ord> PriorityQueue<T> {
 mod tests {
     use sort::merge_sort;
     use core::cmp::le;
-    use priority_queue::PriorityQueue::{from_vec, new};
+    use priority_queue::PriorityQueue;
 
     #[test]
     fn test_top_and_pop() {
         let data = ~[2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
         let mut sorted = merge_sort(data, le);
-        let mut heap = from_vec(data);
+        let mut heap = PriorityQueue::from_vec(data);
         while !heap.is_empty() {
             assert_eq!(heap.top(), sorted.last());
             assert_eq!(heap.pop(), sorted.pop());
@@ -200,7 +200,7 @@ mod tests {
 
     #[test]
     fn test_push() {
-        let mut heap = from_vec(~[2, 4, 9]);
+        let mut heap = PriorityQueue::from_vec(~[2, 4, 9]);
         assert_eq!(heap.len(), 3);
         assert!(*heap.top() == 9);
         heap.push(11);
@@ -222,7 +222,7 @@ mod tests {
 
     #[test]
     fn test_push_unique() {
-        let mut heap = from_vec(~[~2, ~4, ~9]);
+        let mut heap = PriorityQueue::from_vec(~[~2, ~4, ~9]);
         assert_eq!(heap.len(), 3);
         assert!(*heap.top() == ~9);
         heap.push(~11);
@@ -244,7 +244,7 @@ mod tests {
 
     #[test]
     fn test_push_pop() {
-        let mut heap = from_vec(~[5, 5, 2, 1, 3]);
+        let mut heap = PriorityQueue::from_vec(~[5, 5, 2, 1, 3]);
         assert_eq!(heap.len(), 5);
         assert_eq!(heap.push_pop(6), 6);
         assert_eq!(heap.len(), 5);
@@ -258,7 +258,7 @@ mod tests {
 
     #[test]
     fn test_replace() {
-        let mut heap = from_vec(~[5, 5, 2, 1, 3]);
+        let mut heap = PriorityQueue::from_vec(~[5, 5, 2, 1, 3]);
         assert_eq!(heap.len(), 5);
         assert_eq!(heap.replace(6), 5);
         assert_eq!(heap.len(), 5);
@@ -271,7 +271,7 @@ mod tests {
     }
 
     fn check_to_vec(data: ~[int]) {
-        let heap = from_vec(copy data);
+        let heap = PriorityQueue::from_vec(copy data);
         assert_eq!(merge_sort((copy heap).to_vec(), le), merge_sort(data, le));
         assert_eq!(heap.to_sorted_vec(), merge_sort(data, le));
     }
@@ -296,27 +296,27 @@ mod tests {
     #[test]
     #[should_fail]
     #[ignore(cfg(windows))]
-    fn test_empty_pop() { let mut heap = new::<int>(); heap.pop(); }
+    fn test_empty_pop() { let mut heap = PriorityQueue::new::<int>(); heap.pop(); }
 
     #[test]
     fn test_empty_maybe_pop() {
-        let mut heap = new::<int>();
+        let mut heap = PriorityQueue::new::<int>();
         assert!(heap.maybe_pop().is_none());
     }
 
     #[test]
     #[should_fail]
     #[ignore(cfg(windows))]
-    fn test_empty_top() { let empty = new::<int>(); empty.top(); }
+    fn test_empty_top() { let empty = PriorityQueue::new::<int>(); empty.top(); }
 
     #[test]
     fn test_empty_maybe_top() {
-        let empty = new::<int>();
+        let empty = PriorityQueue::new::<int>();
         assert!(empty.maybe_top().is_none());
     }
 
     #[test]
     #[should_fail]
     #[ignore(cfg(windows))]
-    fn test_empty_replace() { let mut heap = new(); heap.replace(5); }
+    fn test_empty_replace() { let mut heap = PriorityQueue::new(); heap.replace(5); }
 }
diff --git a/src/libextra/smallintmap.rs b/src/libextra/smallintmap.rs
index 3e5e62894df..b2a98845b2f 100644
--- a/src/libextra/smallintmap.rs
+++ b/src/libextra/smallintmap.rs
@@ -267,6 +267,8 @@ pub impl SmallIntSet {
 
 #[cfg(test)]
 mod tests {
+    use core::prelude::*;
+
     use super::SmallIntMap;
 
     #[test]
diff --git a/src/libextra/sort.rs b/src/libextra/sort.rs
index 2c4020e776c..388f321d9ea 100644
--- a/src/libextra/sort.rs
+++ b/src/libextra/sort.rs
@@ -746,6 +746,8 @@ fn shift_vec<T:Copy>(dest: &mut [T],
 
 #[cfg(test)]
 mod test_qsort3 {
+    use core::prelude::*;
+
     use sort::*;
 
     use core::vec;
@@ -788,6 +790,8 @@ mod test_qsort3 {
 
 #[cfg(test)]
 mod test_qsort {
+    use core::prelude::*;
+
     use sort::*;
 
     use core::int;
@@ -852,6 +856,7 @@ mod test_qsort {
 
 #[cfg(test)]
 mod tests {
+    use core::prelude::*;
 
     use sort::*;
 
@@ -920,6 +925,8 @@ mod tests {
 
 #[cfg(test)]
 mod test_tim_sort {
+    use core::prelude::*;
+
     use sort::tim_sort;
     use core::rand::RngUtil;
 
@@ -1011,6 +1018,8 @@ mod test_tim_sort {
 
 #[cfg(test)]
 mod big_tests {
+    use core::prelude::*;
+
     use sort::*;
     use core::rand::RngUtil;
 
diff --git a/src/libextra/std.rc b/src/libextra/std.rc
index 7f9902dfc8c..a23a5476342 100644
--- a/src/libextra/std.rc
+++ b/src/libextra/std.rc
@@ -36,6 +36,8 @@ extern mod core(name = "std", vers = "0.7-pre");
 use core::{str, unstable};
 use core::str::{StrSlice, OwnedStr};
 
+pub use core::os;
+
 pub mod uv_ll;
 
 // General io and system-services modules
diff --git a/src/libextra/sync.rs b/src/libextra/sync.rs
index dc7f891b259..9e0ebc02221 100644
--- a/src/libextra/sync.rs
+++ b/src/libextra/sync.rs
@@ -711,6 +711,7 @@ pub impl<'self> RWlockReadMode<'self> {
 
 #[cfg(test)]
 mod tests {
+    use core::prelude::*;
 
     use sync::*;
 
diff --git a/src/libextra/tempfile.rs b/src/libextra/tempfile.rs
index d7ee326f2ff..be9b920c592 100644
--- a/src/libextra/tempfile.rs
+++ b/src/libextra/tempfile.rs
@@ -27,6 +27,8 @@ pub fn mkdtemp(tmpdir: &Path, suffix: &str) -> Option<Path> {
 
 #[cfg(test)]
 mod tests {
+    use core::prelude::*;
+
     use tempfile::mkdtemp;
     use tempfile;
     use core::os;
diff --git a/src/libextra/timer.rs b/src/libextra/timer.rs
index 6a36d674279..75caf1a4829 100644
--- a/src/libextra/timer.rs
+++ b/src/libextra/timer.rs
@@ -175,6 +175,8 @@ extern fn delayed_send_close_cb(handle: *uv::ll::uv_timer_t) {
 
 #[cfg(test)]
 mod test {
+    use core::prelude::*;
+
     use timer::*;
     use uv;
     use core::cell::Cell;
diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs
index f4257070e19..973d1faa9a6 100644
--- a/src/libextra/treemap.rs
+++ b/src/libextra/treemap.rs
@@ -699,6 +699,8 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
 
 #[cfg(test)]
 mod test_treemap {
+    use core::prelude::*;
+
     use core::iterator::*;
     use super::*;
     use core::rand::RngUtil;
@@ -1017,6 +1019,7 @@ mod test_treemap {
 
 #[cfg(test)]
 mod test_set {
+    use core::prelude::*;
     use core::iterator::*;
     use super::*;
 
diff --git a/src/libextra/uv_ll.rs b/src/libextra/uv_ll.rs
index 014dea22029..5be8dd514de 100644
--- a/src/libextra/uv_ll.rs
+++ b/src/libextra/uv_ll.rs
@@ -1224,6 +1224,7 @@ pub unsafe fn addrinfo_as_sockaddr_in6(input: *addrinfo) -> *sockaddr_in6 {
 
 #[cfg(test)]
 mod test {
+    use core::prelude::*;
     use core::comm::{SharedChan, stream, GenericChan, GenericPort};
     use super::*;
 
diff --git a/src/test/auxiliary/extern-crosscrate-source.rs b/src/test/auxiliary/extern-crosscrate-source.rs
index c7e8e899135..3c81c787a09 100644
--- a/src/test/auxiliary/extern-crosscrate-source.rs
+++ b/src/test/auxiliary/extern-crosscrate-source.rs
@@ -15,9 +15,7 @@
 
 pub mod rustrt {
     pub extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
-                                               -> libc::uintptr_t,
-                             data: libc::uintptr_t)
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
                              -> libc::uintptr_t;
     }
 }
diff --git a/src/test/run-pass/const-cast.rs b/src/test/run-pass/const-cast.rs
index 2f7ccfe2a3a..1c8e92b91cd 100644
--- a/src/test/run-pass/const-cast.rs
+++ b/src/test/run-pass/const-cast.rs
@@ -10,7 +10,7 @@
 
 extern fn foo() {}
 
-static x: extern "C" fn() = foo;
+static x: *u8 = foo;
 static y: *libc::c_void = x as *libc::c_void;
 static a: &'static int = &10;
 static b: *int = a as *int;
diff --git a/src/test/run-pass/const-cross-crate-extern.rs b/src/test/run-pass/const-cross-crate-extern.rs
index 66db6c824bc..5281c217626 100644
--- a/src/test/run-pass/const-cross-crate-extern.rs
+++ b/src/test/run-pass/const-cross-crate-extern.rs
@@ -13,7 +13,7 @@
 
 extern mod cci_const;
 use cci_const::bar;
-static foo: extern "C" fn() = bar;
+static foo: *u8 = bar;
 
 pub fn main() {
     assert_eq!(foo, cci_const::bar);
diff --git a/src/test/run-pass/const-extern-function.rs b/src/test/run-pass/const-extern-function.rs
index 513f93a6760..9a8104cb14f 100644
--- a/src/test/run-pass/const-extern-function.rs
+++ b/src/test/run-pass/const-extern-function.rs
@@ -10,7 +10,7 @@
 
 extern fn foopy() {}
 
-static f: extern "C" fn() = foopy;
+static f: *u8 = foopy;
 static s: S = S { f: foopy };
 
 struct S {
diff --git a/src/test/run-pass/extern-call-deep.rs b/src/test/run-pass/extern-call-deep.rs
index 2e95873b60d..6831048bee4 100644
--- a/src/test/run-pass/extern-call-deep.rs
+++ b/src/test/run-pass/extern-call-deep.rs
@@ -10,9 +10,7 @@
 
 mod rustrt {
     pub extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
-                                               -> libc::uintptr_t,
-                             data: libc::uintptr_t)
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
                              -> libc::uintptr_t;
     }
 }
diff --git a/src/test/run-pass/extern-call-deep2.rs b/src/test/run-pass/extern-call-deep2.rs
index 6ad1c531d9a..4c5d4218b1f 100644
--- a/src/test/run-pass/extern-call-deep2.rs
+++ b/src/test/run-pass/extern-call-deep2.rs
@@ -10,9 +10,7 @@
 
 mod rustrt {
     pub extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
-                                               -> libc::uintptr_t,
-                             data: libc::uintptr_t)
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
                              -> libc::uintptr_t;
     }
 }
diff --git a/src/test/run-pass/extern-call-scrub.rs b/src/test/run-pass/extern-call-scrub.rs
index 2caf4cbf2bc..5c4d594476f 100644
--- a/src/test/run-pass/extern-call-scrub.rs
+++ b/src/test/run-pass/extern-call-scrub.rs
@@ -14,9 +14,7 @@
 
 mod rustrt {
     pub extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
-                                               -> libc::uintptr_t,
-                             data: libc::uintptr_t)
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
                              -> libc::uintptr_t;
     }
 }
diff --git a/src/test/run-pass/extern-call.rs b/src/test/run-pass/extern-call.rs
index 6c36c4aa8f6..ec335cf8a82 100644
--- a/src/test/run-pass/extern-call.rs
+++ b/src/test/run-pass/extern-call.rs
@@ -10,9 +10,7 @@
 
 mod rustrt {
     pub extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
-                                               -> libc::uintptr_t,
-                             data: libc::uintptr_t)
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
                              -> libc::uintptr_t;
     }
 }
diff --git a/src/test/run-pass/extern-stress.rs b/src/test/run-pass/extern-stress.rs
index b12295ab576..4257f2b2435 100644
--- a/src/test/run-pass/extern-stress.rs
+++ b/src/test/run-pass/extern-stress.rs
@@ -13,9 +13,7 @@
 
 mod rustrt {
     pub extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
-                                               -> libc::uintptr_t,
-                             data: libc::uintptr_t)
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
                              -> libc::uintptr_t;
     }
 }
diff --git a/src/test/run-pass/extern-take-value.rs b/src/test/run-pass/extern-take-value.rs
index c3fe458802d..542686c9099 100644
--- a/src/test/run-pass/extern-take-value.rs
+++ b/src/test/run-pass/extern-take-value.rs
@@ -15,10 +15,10 @@ extern fn g() {
 }
 
 pub fn main() {
-    // extern functions are extern function types
-    let a: extern "C" fn() = f;
-    let b: extern "C" fn() = f;
-    let c: extern "C" fn() = g;
+    // extern functions are *u8 types
+    let a: *u8 = f;
+    let b: *u8 = f;
+    let c: *u8 = g;
 
     assert_eq!(a, b);
     assert!(a != c);
diff --git a/src/test/run-pass/extern-yield.rs b/src/test/run-pass/extern-yield.rs
index 16b1c7cd6f4..b0c44030a17 100644
--- a/src/test/run-pass/extern-yield.rs
+++ b/src/test/run-pass/extern-yield.rs
@@ -10,9 +10,7 @@
 
 mod rustrt {
     pub extern {
-        pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
-                                               -> libc::uintptr_t,
-                             data: libc::uintptr_t)
+        pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
                              -> libc::uintptr_t;
     }
 }
diff --git a/src/test/run-pass/foreign-call-no-runtime.rs b/src/test/run-pass/foreign-call-no-runtime.rs
index 67efca194d5..6ff8b24ab83 100644
--- a/src/test/run-pass/foreign-call-no-runtime.rs
+++ b/src/test/run-pass/foreign-call-no-runtime.rs
@@ -1,9 +1,7 @@
 use std::unstable::run_in_bare_thread;
 
 extern {
-    pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t)
-                                           -> libc::uintptr_t,
-                         data: libc::uintptr_t) -> libc::uintptr_t;
+    pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) -> libc::uintptr_t;
 }
 
 pub fn main() {