diff options
Diffstat (limited to 'src/libtest')
| -rw-r--r-- | src/libtest/lib.rs | 20 | ||||
| -rw-r--r-- | src/libtest/stats.rs | 6 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 76df9ea4561..3ee2b1b2224 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -95,7 +95,11 @@ pub mod stats; // colons. This way if some test runner wants to arrange the tests // hierarchically it may. +<<<<<<< HEAD #[derive(Clone, PartialEq, Eq, Hash)] +======= +#[deriving(Clone, PartialEq, Eq, Hash, Show)] +>>>>>>> core: split into fmt::Show and fmt::String pub enum TestName { StaticTestName(&'static str), DynTestName(String) @@ -108,9 +112,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 +261,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 +414,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 +797,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 +916,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())); } } @@ -1206,7 +1210,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..3e7e379cd78 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) |
