summary refs log tree commit diff
path: root/src/libtest
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-07 05:31:23 +0000
committerbors <bors@rust-lang.org>2015-01-07 05:31:23 +0000
commit9e4e524e0eb17c8f463e731f23b544003e8709c6 (patch)
tree916024d35e08f0826c20654f629ec596b5cb1f14 /src/libtest
parentea6f65c5f1a3f84e010d2cef02a0160804e9567a (diff)
parenta64000820f0fc32be4d7535a9a92418a434fa4ba (diff)
downloadrust-9e4e524e0eb17c8f463e731f23b544003e8709c6.tar.gz
rust-9e4e524e0eb17c8f463e731f23b544003e8709c6.zip
auto merge of #20677 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libtest')
-rw-r--r--src/libtest/lib.rs30
-rw-r--r--src/libtest/stats.rs8
2 files changed, 17 insertions, 21 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index c417fd94e22..68d06cc4dab 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -30,11 +30,7 @@
 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/")]
-
-#![allow(unknown_features)]
-#![feature(asm, globs, slicing_syntax)]
-#![feature(unboxed_closures, default_type_params)]
-#![feature(old_orphan_check)]
+#![feature(asm, slicing_syntax)]
 
 extern crate getopts;
 extern crate regex;
@@ -95,7 +91,7 @@ pub mod stats;
 // colons. This way if some test runner wants to arrange the tests
 // hierarchically it may.
 
-#[derive(Clone, PartialEq, Eq, Hash)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
 pub enum TestName {
     StaticTestName(&'static str),
     DynTestName(String)
@@ -108,9 +104,9 @@ impl TestName {
         }
     }
 }
-impl Show for TestName {
+impl fmt::String for TestName {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.as_slice().fmt(f)
+        fmt::String::fmt(self.as_slice(), f)
     }
 }
 
@@ -257,13 +253,13 @@ pub fn test_main(args: &[String], tests: Vec<TestDescAndFn> ) {
     let opts =
         match parse_opts(args) {
             Some(Ok(o)) => o,
-            Some(Err(msg)) => panic!("{}", msg),
+            Some(Err(msg)) => panic!("{:?}", msg),
             None => return
         };
     match run_tests_console(&opts, tests) {
         Ok(true) => {}
         Ok(false) => panic!("Some tests failed"),
-        Err(e) => panic!("io error when running tests: {}", e),
+        Err(e) => panic!("io error when running tests: {:?}", e),
     }
 }
 
@@ -410,7 +406,7 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
         let s = matches.free[0].as_slice();
         match Regex::new(s) {
             Ok(re) => Some(re),
-            Err(e) => return Some(Err(format!("could not parse /{}/: {}", s, e)))
+            Err(e) => return Some(Err(format!("could not parse /{}/: {:?}", s, e)))
         }
     } else {
         None
@@ -793,7 +789,7 @@ impl<T: Writer> ConsoleTestState<T> {
         let ratchet_success = match *ratchet_metrics {
             None => true,
             Some(ref pth) => {
-                try!(self.write_plain(format!("\nusing metrics ratchet: {}\n",
+                try!(self.write_plain(format!("\nusing metrics ratchet: {:?}\n",
                                               pth.display()).as_slice()));
                 match ratchet_pct {
                     None => (),
@@ -912,7 +908,7 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn> ) -> io::IoR
         None => (),
         Some(ref pth) => {
             try!(st.metrics.save(pth));
-            try!(st.write_plain(format!("\nmetrics saved to: {}",
+            try!(st.write_plain(format!("\nmetrics saved to: {:?}",
                                           pth.display()).as_slice()));
         }
     }
@@ -952,7 +948,7 @@ fn should_sort_failures_before_printing_them() {
 
     st.write_failures().unwrap();
     let s = match st.out {
-        Raw(ref m) => String::from_utf8_lossy(m[]),
+        Raw(ref m) => String::from_utf8_lossy(m.index(&FullRange)),
         Pretty(_) => unreachable!()
     };
 
@@ -1137,11 +1133,11 @@ pub fn run_test(opts: &TestOpts,
                 cfg = cfg.stderr(box stderr as Box<Writer + Send>);
             }
 
-            let result_guard = cfg.spawn(move || { testfn.invoke(()) });
+            let result_guard = cfg.scoped(move || { testfn.invoke(()) });
             let stdout = reader.read_to_end().unwrap().into_iter().collect();
             let test_result = calc_result(&desc, result_guard.join());
             monitor_ch.send((desc.clone(), test_result, stdout)).unwrap();
-        }).detach();
+        });
     }
 
     match testfn {
@@ -1206,7 +1202,7 @@ impl MetricMap {
         let mut decoder = json::Decoder::new(value);
         MetricMap(match Decodable::decode(&mut decoder) {
             Ok(t) => t,
-            Err(e) => panic!("failure decoding JSON: {}", e)
+            Err(e) => panic!("failure decoding JSON: {:?}", e)
         })
     }
 
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index bdc05a50301..1abb52459e4 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -13,7 +13,7 @@
 use std::cmp::Ordering::{self, Less, Greater, Equal};
 use std::collections::hash_map::Entry::{Occupied, Vacant};
 use std::collections::hash_map;
-use std::fmt::Show;
+use std::fmt;
 use std::hash::Hash;
 use std::io;
 use std::mem;
@@ -333,7 +333,7 @@ pub fn winsorize<T: Float + FromPrimitive>(samples: &mut [T], pct: T) {
 }
 
 /// Render writes the min, max and quartiles of the provided `Summary` to the provided `Writer`.
-pub fn write_5_number_summary<W: Writer, T: Float + Show>(w: &mut W,
+pub fn write_5_number_summary<W: Writer, T: Float + fmt::String + fmt::Show>(w: &mut W,
                                                           s: &Summary<T>) -> io::IoResult<()> {
     let (q1,q2,q3) = s.quartiles;
     write!(w, "(min={}, q1={}, med={}, q3={}, max={})",
@@ -355,7 +355,7 @@ pub fn write_5_number_summary<W: Writer, T: Float + Show>(w: &mut W,
 /// ```{.ignore}
 ///   10 |        [--****#******----------]          | 40
 /// ```
-pub fn write_boxplot<W: Writer, T: Float + Show + FromPrimitive>(
+pub fn write_boxplot<W: Writer, T: Float + fmt::String + fmt::Show + FromPrimitive>(
                      w: &mut W,
                      s: &Summary<T>,
                      width_hint: uint)
@@ -444,7 +444,7 @@ pub fn freq_count<T, U>(mut iter: T) -> hash_map::HashMap<U, uint>
 {
     let mut map: hash_map::HashMap<U,uint> = hash_map::HashMap::new();
     for elem in iter {
-        match map.entry(&elem) {
+        match map.entry(elem) {
             Occupied(mut entry) => { *entry.get_mut() += 1; },
             Vacant(entry) => { entry.insert(1); },
         }