about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-07-11 12:05:17 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-07-17 14:57:54 -0700
commit2dbb3c3887ff23c064aa762eb4dafaf4967c6416 (patch)
tree6d143b2480375aa7a5e56a22a37e29e215a51af3 /src/libextra
parente20549ff192edec9d625f1119bcb077c3abaf070 (diff)
downloadrust-2dbb3c3887ff23c064aa762eb4dafaf4967c6416.tar.gz
rust-2dbb3c3887ff23c064aa762eb4dafaf4967c6416.zip
test: Fix tests.
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/bitv.rs2
-rw-r--r--src/libextra/crypto/sha1.rs13
-rw-r--r--src/libextra/fileinput.rs8
-rw-r--r--src/libextra/list.rs2
-rw-r--r--src/libextra/net/ip.rs1
-rw-r--r--src/libextra/net/tcp.rs2
-rw-r--r--src/libextra/priority_queue.rs3
-rw-r--r--src/libextra/sort.rs6
-rw-r--r--src/libextra/test.rs2
-rw-r--r--src/libextra/uv_ll.rs8
10 files changed, 33 insertions, 14 deletions
diff --git a/src/libextra/bitv.rs b/src/libextra/bitv.rs
index f3f0f42125d..106b7c80f18 100644
--- a/src/libextra/bitv.rs
+++ b/src/libextra/bitv.rs
@@ -1453,7 +1453,7 @@ mod tests {
     fn bench_big_bitv_big(b: &mut BenchHarness) {
         let mut r = rng();
         let mut storage = ~[];
-        storage.grow(BENCH_BITS / uint::bits, &0);
+        storage.grow(BENCH_BITS / uint::bits, &0u);
         let mut bitv = BigBitv::new(storage);
         do b.iter {
             bitv.set((r.next() as uint) % BENCH_BITS, true);
diff --git a/src/libextra/crypto/sha1.rs b/src/libextra/crypto/sha1.rs
index 0f2d44f57e3..83cef9972d7 100644
--- a/src/libextra/crypto/sha1.rs
+++ b/src/libextra/crypto/sha1.rs
@@ -244,14 +244,15 @@ mod tests {
     use digest::{Digest, DigestUtil};
     use sha1::Sha1;
 
+    #[deriving(Clone)]
+    struct Test {
+        input: ~str,
+        output: ~[u8],
+        output_str: ~str,
+    }
+
     #[test]
     fn test() {
-        struct Test {
-            input: ~str,
-            output: ~[u8],
-            output_str: ~str,
-        }
-
         fn a_million_letter_a() -> ~str {
             let mut i = 0;
             let mut rs = ~"";
diff --git a/src/libextra/fileinput.rs b/src/libextra/fileinput.rs
index cc87809ad5b..f7c54634fe4 100644
--- a/src/libextra/fileinput.rs
+++ b/src/libextra/fileinput.rs
@@ -417,7 +417,7 @@ mod test {
     use std::vec;
 
     fn make_file(path : &Path, contents: &[~str]) {
-        let file = io::file_writer(path, [io::Create, io::Truncate]).get();
+        let file = io::file_writer(path, [io::Create, io::Truncate]).unwrap();
 
         for contents.iter().advance |str| {
             file.write_str(*str);
@@ -562,9 +562,11 @@ mod test {
         let f2 =
             Some(Path("tmp/lib-fileinput-test-no-trailing-newline-2.tmp"));
 
-        let wr = io::file_writer(f1.get_ref(), [io::Create, io::Truncate]).get();
+        let wr = io::file_writer(f1.get_ref(),
+                                 [io::Create, io::Truncate]).unwrap();
         wr.write_str("1\n2");
-        let wr = io::file_writer(f2.get_ref(), [io::Create, io::Truncate]).get();
+        let wr = io::file_writer(f2.get_ref(),
+                                 [io::Create, io::Truncate]).unwrap();
         wr.write_str("3\n4");
 
         let mut lines = ~[];
diff --git a/src/libextra/list.rs b/src/libextra/list.rs
index 87d0c05aec1..03481760579 100644
--- a/src/libextra/list.rs
+++ b/src/libextra/list.rs
@@ -12,7 +12,7 @@
 
 
 
-#[deriving(Eq)]
+#[deriving(Clone, Eq)]
 pub enum List<T> {
     Cons(T, @List<T>),
     Nil,
diff --git a/src/libextra/net/ip.rs b/src/libextra/net/ip.rs
index 4c3fefc6eed..c1633ffa041 100644
--- a/src/libextra/net/ip.rs
+++ b/src/libextra/net/ip.rs
@@ -38,6 +38,7 @@ use get_data_for_req = uv_ll::get_data_for_req;
 use ll = uv_ll;
 
 /// An IP address
+#[deriving(Clone)]
 pub enum IpAddr {
     /// An IPv4 address
     Ipv4(sockaddr_in),
diff --git a/src/libextra/net/tcp.rs b/src/libextra/net/tcp.rs
index eebb8490aa2..122d4b85628 100644
--- a/src/libextra/net/tcp.rs
+++ b/src/libextra/net/tcp.rs
@@ -93,6 +93,7 @@ pub struct TcpErrData {
 }
 
 /// Details returned as part of a `Result::Err` result from `tcp::listen`
+#[deriving(Clone)]
 pub enum TcpListenErrData {
     /**
      * Some unplanned-for error. The first and second fields correspond
@@ -120,6 +121,7 @@ pub enum TcpListenErrData {
     AccessDenied
 }
 /// Details returned as part of a `Result::Err` result from `tcp::connect`
+#[deriving(Clone)]
 pub enum TcpConnectErrData {
     /**
      * Some unplanned-for error. The first and second fields correspond
diff --git a/src/libextra/priority_queue.rs b/src/libextra/priority_queue.rs
index dc274dfb814..d07b645a541 100644
--- a/src/libextra/priority_queue.rs
+++ b/src/libextra/priority_queue.rs
@@ -12,13 +12,14 @@
 
 #[allow(missing_doc)];
 
-
+use std::clone::Clone;
 use std::unstable::intrinsics::{move_val_init, init};
 use std::util::{replace, swap};
 use std::vec;
 use std::iterator::FromIterator;
 
 /// A priority queue implemented with a binary heap
+#[deriving(Clone)]
 pub struct PriorityQueue<T> {
     priv data: ~[T],
 }
diff --git a/src/libextra/sort.rs b/src/libextra/sort.rs
index a11b819dda1..a1cd2dfb240 100644
--- a/src/libextra/sort.rs
+++ b/src/libextra/sort.rs
@@ -926,6 +926,7 @@ mod test_tim_sort {
     use std::rand;
     use std::vec;
 
+    #[deriving(Clone)]
     struct CVal {
         val: float,
     }
@@ -992,7 +993,10 @@ mod test_tim_sort {
         fail!("Guarantee the fail");
     }
 
-    struct DVal { val: uint }
+    #[deriving(Clone)]
+    struct DVal {
+        val: uint,
+    }
 
     impl Ord for DVal {
         fn lt(&self, _x: &DVal) -> bool { true }
diff --git a/src/libextra/test.rs b/src/libextra/test.rs
index b45e1d6323b..0a1811968f0 100644
--- a/src/libextra/test.rs
+++ b/src/libextra/test.rs
@@ -1245,7 +1245,7 @@ mod tests {
                         ignore: false,
                         should_fail: false
                     },
-                    testfn: DynTestFn(testfn.clone()),
+                    testfn: DynTestFn(testfn),
                 };
                 tests.push(test);
             }
diff --git a/src/libextra/uv_ll.rs b/src/libextra/uv_ll.rs
index 74798d260c1..1527b090f94 100644
--- a/src/libextra/uv_ll.rs
+++ b/src/libextra/uv_ll.rs
@@ -266,6 +266,7 @@ pub struct uv_timer_t {
 }
 
 // unix size: 16
+#[deriving(Clone)]
 pub struct sockaddr_in {
     sin_family: u16,
     sin_port: u16,
@@ -280,6 +281,7 @@ pub struct sockaddr_in6 {
     a0: *u8, a1: *u8,
     a2: *u8, a3: *u8,
 }
+
 #[cfg(target_arch="x86")]
 #[cfg(target_arch="arm")]
 #[cfg(target_arch="mips")]
@@ -290,6 +292,12 @@ pub struct sockaddr_in6 {
     a6: *u8, a7: *u8,
 }
 
+impl Clone for sockaddr_in6 {
+    fn clone(&self) -> sockaddr_in6 {
+        *self
+    }
+}
+
 // unix size: 28 .. FIXME #1645
 // stuck with 32 because of rust padding structs?
 pub type addr_in = addr_in_impl::addr_in;