about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-01-30 14:28:20 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-02-03 09:32:34 -0800
commit41cde566bb81bdd5f9ffdefadc7c8256c65624dc (patch)
tree5e604ccb7379c89f7c81558b5376a5ffde0035af /src
parent209642c65177d6cf42dd4eea693040aa91cde9ee (diff)
downloadrust-41cde566bb81bdd5f9ffdefadc7c8256c65624dc.tar.gz
rust-41cde566bb81bdd5f9ffdefadc7c8256c65624dc.zip
extra: Fix tests with io_error usage
Diffstat (limited to 'src')
-rw-r--r--src/libextra/arc.rs20
-rw-r--r--src/libextra/base64.rs2
-rw-r--r--src/libextra/hex.rs2
-rw-r--r--src/libextra/stats.rs12
-rw-r--r--src/libextra/sync.rs2
-rw-r--r--src/libextra/test.rs4
-rw-r--r--src/libextra/uuid.rs2
-rw-r--r--src/libextra/workcache.rs9
-rw-r--r--src/libterm/terminfo/searcher.rs2
9 files changed, 28 insertions, 27 deletions
diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs
index 43366d2aa6d..9615bdc2ad7 100644
--- a/src/libextra/arc.rs
+++ b/src/libextra/arc.rs
@@ -637,7 +637,7 @@ mod tests {
     fn test_mutex_arc_poison() {
         let arc = ~MutexArc::new(1);
         let arc2 = ~arc.clone();
-        task::try(proc() {
+        let _ = task::try(proc() {
             arc2.access(|one| {
                 assert_eq!(*one, 2);
             })
@@ -668,7 +668,7 @@ mod tests {
     fn test_mutex_arc_access_in_unwind() {
         let arc = MutexArc::new(1i);
         let arc2 = arc.clone();
-        task::try::<()>(proc() {
+        let _ = task::try::<()>(proc() {
             struct Unwinder {
                 i: MutexArc<int>
             }
@@ -687,7 +687,7 @@ mod tests {
     fn test_rw_arc_poison_wr() {
         let arc = RWArc::new(1);
         let arc2 = arc.clone();
-        task::try(proc() {
+        let _ = task::try(proc() {
             arc2.write(|one| {
                 assert_eq!(*one, 2);
             })
@@ -701,7 +701,7 @@ mod tests {
     fn test_rw_arc_poison_ww() {
         let arc = RWArc::new(1);
         let arc2 = arc.clone();
-        task::try(proc() {
+        let _ = task::try(proc() {
             arc2.write(|one| {
                 assert_eq!(*one, 2);
             })
@@ -714,7 +714,7 @@ mod tests {
     fn test_rw_arc_poison_dw() {
         let arc = RWArc::new(1);
         let arc2 = arc.clone();
-        task::try(proc() {
+        let _ = task::try(proc() {
             arc2.write_downgrade(|mut write_mode| {
                 write_mode.write(|one| {
                     assert_eq!(*one, 2);
@@ -729,7 +729,7 @@ mod tests {
     fn test_rw_arc_no_poison_rr() {
         let arc = RWArc::new(1);
         let arc2 = arc.clone();
-        task::try(proc() {
+        let _ = task::try(proc() {
             arc2.read(|one| {
                 assert_eq!(*one, 2);
             })
@@ -742,7 +742,7 @@ mod tests {
     fn test_rw_arc_no_poison_rw() {
         let arc = RWArc::new(1);
         let arc2 = arc.clone();
-        task::try(proc() {
+        let _ = task::try(proc() {
             arc2.read(|one| {
                 assert_eq!(*one, 2);
             })
@@ -755,7 +755,7 @@ mod tests {
     fn test_rw_arc_no_poison_dr() {
         let arc = RWArc::new(1);
         let arc2 = arc.clone();
-        task::try(proc() {
+        let _ = task::try(proc() {
             arc2.write_downgrade(|write_mode| {
                 let read_mode = arc2.downgrade(write_mode);
                 read_mode.read(|one| {
@@ -800,7 +800,7 @@ mod tests {
 
         // Wait for children to pass their asserts
         for r in children.mut_iter() {
-            r.recv();
+            let _ = r.recv();
         }
 
         // Wait for writer to finish
@@ -814,7 +814,7 @@ mod tests {
     fn test_rw_arc_access_in_unwind() {
         let arc = RWArc::new(1i);
         let arc2 = arc.clone();
-        task::try::<()>(proc() {
+        let _ = task::try::<()>(proc() {
             struct Unwinder {
                 i: RWArc<int>
             }
diff --git a/src/libextra/base64.rs b/src/libextra/base64.rs
index 738afcd5c5f..556032af1ac 100644
--- a/src/libextra/base64.rs
+++ b/src/libextra/base64.rs
@@ -359,7 +359,7 @@ mod test {
                  ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン";
         let b = s.as_bytes().to_base64(STANDARD);
         bh.iter(|| {
-            b.from_base64();
+            b.from_base64().unwrap();
         });
         bh.bytes = b.len() as u64;
     }
diff --git a/src/libextra/hex.rs b/src/libextra/hex.rs
index 4fd59bb3aa5..d4e1ae12337 100644
--- a/src/libextra/hex.rs
+++ b/src/libextra/hex.rs
@@ -201,7 +201,7 @@ mod tests {
                  ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン";
         let b = s.as_bytes().to_hex();
         bh.iter(|| {
-            b.from_hex();
+            b.from_hex().unwrap();
         });
         bh.bytes = b.len() as u64;
     }
diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs
index 8c7b7f4a736..8752020f564 100644
--- a/src/libextra/stats.rs
+++ b/src/libextra/stats.rs
@@ -456,11 +456,11 @@ mod tests {
 
         let mut w = io::stdout();
         let w = &mut w as &mut io::Writer;
-        write!(w, "\n");
-        write_5_number_summary(w, &summ2);
-        write!(w, "\n");
-        write_boxplot(w, &summ2, 50);
-        write!(w, "\n");
+        (write!(w, "\n")).unwrap();
+        write_5_number_summary(w, &summ2).unwrap();
+        (write!(w, "\n")).unwrap();
+        write_boxplot(w, &summ2, 50).unwrap();
+        (write!(w, "\n")).unwrap();
 
         assert_eq!(summ.sum, summ2.sum);
         assert_eq!(summ.min, summ2.min);
@@ -1003,7 +1003,7 @@ mod tests {
         fn t(s: &Summary, expected: ~str) {
             use std::io::MemWriter;
             let mut m = MemWriter::new();
-            write_boxplot(&mut m as &mut io::Writer, s, 30);
+            write_boxplot(&mut m as &mut io::Writer, s, 30).unwrap();
             let out = str::from_utf8_owned(m.unwrap()).unwrap();
             assert_eq!(out, expected);
         }
diff --git a/src/libextra/sync.rs b/src/libextra/sync.rs
index 26a555a646c..0a29fd18982 100644
--- a/src/libextra/sync.rs
+++ b/src/libextra/sync.rs
@@ -959,7 +959,7 @@ mod tests {
     fn test_mutex_cond_no_waiter() {
         let m = Mutex::new();
         let m2 = m.clone();
-        task::try(proc() {
+        let _ = task::try(proc() {
             m.lock_cond(|_x| { })
         });
         m2.lock_cond(|cond| {
diff --git a/src/libextra/test.rs b/src/libextra/test.rs
index f562c50935b..c4d27b25b55 100644
--- a/src/libextra/test.rs
+++ b/src/libextra/test.rs
@@ -720,7 +720,7 @@ fn should_sort_failures_before_printing_them() {
         failures: ~[test_b, test_a]
     };
 
-    st.write_failures();
+    st.write_failures().unwrap();
     let s = match st.out {
         Raw(ref m) => str::from_utf8(m.get_ref()).unwrap(),
         Pretty(_) => unreachable!()
@@ -1485,7 +1485,7 @@ mod tests {
         m2.insert_metric("runtime", 1100.0, 2.0);
         m2.insert_metric("throughput", 50.0, 2.0);
 
-        m1.save(&pth);
+        m1.save(&pth).unwrap();
 
         // Ask for a ratchet that should fail to advance.
         let (diff1, ok1) = m2.ratchet(&pth, None);
diff --git a/src/libextra/uuid.rs b/src/libextra/uuid.rs
index 9163a892039..29d3066b2f5 100644
--- a/src/libextra/uuid.rs
+++ b/src/libextra/uuid.rs
@@ -821,7 +821,7 @@ mod bench {
     pub fn parse_str(bh: &mut BenchHarness) {
         let s = "urn:uuid:F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4";
         bh.iter(|| {
-            Uuid::parse_string(s);
+            Uuid::parse_string(s).unwrap();
         })
     }
 }
diff --git a/src/libextra/workcache.rs b/src/libextra/workcache.rs
index 3d91ccda189..4d8e7e50dcf 100644
--- a/src/libextra/workcache.rs
+++ b/src/libextra/workcache.rs
@@ -473,13 +473,13 @@ fn test() {
     fn make_path(filename: ~str) -> Path {
         let pth = os::self_exe_path().expect("workcache::test failed").with_filename(filename);
         if pth.exists() {
-            fs::unlink(&pth);
+            fs::unlink(&pth).unwrap();
         }
         return pth;
     }
 
     let pth = make_path(~"foo.c");
-    File::create(&pth).write(bytes!("int main() { return 0; }"));
+    File::create(&pth).write(bytes!("int main() { return 0; }")).unwrap();
 
     let db_path = make_path(~"db.json");
 
@@ -491,7 +491,8 @@ fn test() {
         let subcx = cx.clone();
         let pth = pth.clone();
 
-        let file_content = from_utf8_owned(File::open(&pth).read_to_end()).unwrap();
+        let contents = File::open(&pth).read_to_end().unwrap();
+        let file_content = from_utf8_owned(contents).unwrap();
 
         // FIXME (#9639): This needs to handle non-utf8 paths
         prep.declare_input("file", pth.as_str().unwrap(), file_content);
@@ -500,7 +501,7 @@ fn test() {
             // FIXME (#9639): This needs to handle non-utf8 paths
             run::process_status("gcc", [pth.as_str().unwrap().to_owned(),
                                         ~"-o",
-                                        out.as_str().unwrap().to_owned()]);
+                                        out.as_str().unwrap().to_owned()]).unwrap();
 
             let _proof_of_concept = subcx.prep("subfn");
             // Could run sub-rules inside here.
diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs
index 421f8581b58..5b536d9aafa 100644
--- a/src/libterm/terminfo/searcher.rs
+++ b/src/libterm/terminfo/searcher.rs
@@ -106,7 +106,7 @@ fn test_get_dbpath_for_term() {
 #[test]
 #[ignore(reason = "see test_get_dbpath_for_term")]
 fn test_open() {
-    open("screen");
+    open("screen").unwrap();
     let t = open("nonexistent terminal that hopefully does not exist");
     assert!(t.is_err());
 }