rollup merge of #20481: seanmonstar/fmt-show-string
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
This commit is contained in:
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user