提交 3bab3dc5 编写于 作者: L Luqman Aden

libstd: Remove all uses of {:?}.

上级 814586be
......@@ -183,7 +183,7 @@ fn test_loading_cosine() {
let expected_result = 1.0;
let result = cosine(argument);
if result != expected_result {
fail!("cos({:?}) != {:?} but equaled {:?} instead", argument,
fail!("cos({}) != {} but equaled {} instead", argument,
expected_result, result)
}
}
......
......@@ -963,7 +963,7 @@ mod test {
macro_rules! error( ($e:expr, $s:expr) => (
match $e {
Ok(val) => fail!("Should have been an error, was {:?}", val),
Ok(val) => fail!("Unexpected success. Should've been: {}", $s),
Err(ref err) => assert!(err.to_string().as_slice().contains($s.as_slice()),
format!("`{}` did not contain `{}`", err, $s))
}
......
......@@ -340,7 +340,7 @@ fn write_begone() {
assert!(e.kind == BrokenPipe ||
e.kind == NotConnected ||
e.kind == ConnectionReset,
"unknown error {:?}", e);
"unknown error {}", e);
break;
}
}
......
......@@ -1975,7 +1975,7 @@ fn test_self_exe_name() {
let path = os::self_exe_name();
assert!(path.is_some());
let path = path.unwrap();
debug!("{:?}", path.clone());
debug!("{}", path.display());
// Hard to test this function
assert!(path.is_absolute());
......@@ -1986,7 +1986,7 @@ fn test_self_exe_path() {
let path = os::self_exe_path();
assert!(path.is_some());
let path = path.unwrap();
debug!("{:?}", path.clone());
debug!("{}", path.display());
// Hard to test this function
assert!(path.is_absolute());
......@@ -1999,7 +1999,7 @@ fn test_env_getenv() {
assert!(e.len() > 0u);
for p in e.iter() {
let (n, v) = (*p).clone();
debug!("{:?}", n.clone());
debug!("{}", n);
let v2 = getenv(n.as_slice());
// MingW seems to set some funky environment variables like
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
......@@ -2037,8 +2037,8 @@ fn test() {
let cwd = getcwd();
debug!("Current working directory: {}", cwd.display());
debug!("{:?}", make_absolute(&Path::new("test-path")));
debug!("{:?}", make_absolute(&Path::new("/usr/bin")));
debug!("{}", make_absolute(&Path::new("test-path")).display());
debug!("{}", make_absolute(&Path::new("/usr/bin")).display());
}
#[test]
......
......@@ -986,19 +986,19 @@ fn test_getters() {
let path = $path;
let filename = $filename;
assert!(path.filename_str() == filename,
"{}.filename_str(): Expected `{:?}`, found {:?}",
"{}.filename_str(): Expected `{}`, found {}",
path.as_str().unwrap(), filename, path.filename_str());
let dirname = $dirname;
assert!(path.dirname_str() == dirname,
"`{}`.dirname_str(): Expected `{:?}`, found `{:?}`",
"`{}`.dirname_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), dirname, path.dirname_str());
let filestem = $filestem;
assert!(path.filestem_str() == filestem,
"`{}`.filestem_str(): Expected `{:?}`, found `{:?}`",
"`{}`.filestem_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), filestem, path.filestem_str());
let ext = $ext;
assert!(path.extension_str() == mem::transmute(ext),
"`{}`.extension_str(): Expected `{:?}`, found `{:?}`",
"`{}`.extension_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), ext, path.extension_str());
}
}
......@@ -1200,11 +1200,11 @@ fn test_components_iter() {
let comps = path.components().collect::<Vec<&[u8]>>();
let exp: &[&str] = $exp;
let exps = exp.iter().map(|x| x.as_bytes()).collect::<Vec<&[u8]>>();
assert!(comps == exps, "components: Expected {:?}, found {:?}",
assert!(comps == exps, "components: Expected {}, found {}",
comps, exps);
let comps = path.components().rev().collect::<Vec<&[u8]>>();
let exps = exps.into_iter().rev().collect::<Vec<&[u8]>>();
assert!(comps == exps, "rev_components: Expected {:?}, found {:?}",
assert!(comps == exps, "rev_components: Expected {}, found {}",
comps, exps);
}
);
......
......@@ -996,7 +996,7 @@ pub fn is_sep_byte_verbatim(u: &u8) -> bool {
}
/// Prefix types for Path
#[deriving(PartialEq, Clone)]
#[deriving(PartialEq, Clone, Show)]
pub enum PathPrefix {
/// Prefix `\\?\`, uint is the length of the following component
VerbatimPrefix(uint),
......@@ -1172,7 +1172,7 @@ fn test_parse_prefix() {
let exp = $exp;
let res = parse_prefix(path);
assert!(res == exp,
"parse_prefix(\"{}\"): expected {:?}, found {:?}", path, exp, res);
"parse_prefix(\"{}\"): expected {}, found {}", path, exp, res);
}
)
)
......@@ -1904,19 +1904,19 @@ fn test_getters() {
let path = $path;
let filename = $filename;
assert!(path.filename_str() == filename,
"`{}`.filename_str(): Expected `{:?}`, found `{:?}`",
"`{}`.filename_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), filename, path.filename_str());
let dirname = $dirname;
assert!(path.dirname_str() == dirname,
"`{}`.dirname_str(): Expected `{:?}`, found `{:?}`",
"`{}`.dirname_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), dirname, path.dirname_str());
let filestem = $filestem;
assert!(path.filestem_str() == filestem,
"`{}`.filestem_str(): Expected `{:?}`, found `{:?}`",
"`{}`.filestem_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), filestem, path.filestem_str());
let ext = $ext;
assert!(path.extension_str() == mem::transmute(ext),
"`{}`.extension_str(): Expected `{:?}`, found `{:?}`",
"`{}`.extension_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), ext, path.extension_str());
}
}
......@@ -1974,16 +1974,16 @@ fn test_is_absolute() {
let path = Path::new($path);
let (abs, vol, cwd, rel) = ($abs, $vol, $cwd, $rel);
let b = path.is_absolute();
assert!(b == abs, "Path '{}'.is_absolute(): expected {:?}, found {:?}",
assert!(b == abs, "Path '{}'.is_absolute(): expected {}, found {}",
path.as_str().unwrap(), abs, b);
let b = is_vol_relative(&path);
assert!(b == vol, "is_vol_relative('{}'): expected {:?}, found {:?}",
assert!(b == vol, "is_vol_relative('{}'): expected {}, found {}",
path.as_str().unwrap(), vol, b);
let b = is_cwd_relative(&path);
assert!(b == cwd, "is_cwd_relative('{}'): expected {:?}, found {:?}",
assert!(b == cwd, "is_cwd_relative('{}'): expected {}, found {}",
path.as_str().unwrap(), cwd, b);
let b = path.is_relative();
assert!(b == rel, "Path '{}'.is_relativf(): expected {:?}, found {:?}",
assert!(b == rel, "Path '{}'.is_relativf(): expected {}, found {}",
path.as_str().unwrap(), rel, b);
}
)
......@@ -2016,7 +2016,7 @@ fn test_is_ancestor_of() {
let exp = $exp;
let res = path.is_ancestor_of(&dest);
assert!(res == exp,
"`{}`.is_ancestor_of(`{}`): Expected {:?}, found {:?}",
"`{}`.is_ancestor_of(`{}`): Expected {}, found {}",
path.as_str().unwrap(), dest.as_str().unwrap(), exp, res);
}
)
......@@ -2151,7 +2151,7 @@ fn test_path_relative_from() {
let res = path.path_relative_from(&other);
let exp = $exp;
assert!(res.as_ref().and_then(|x| x.as_str()) == exp,
"`{}`.path_relative_from(`{}`): Expected {:?}, got {:?}",
"`{}`.path_relative_from(`{}`): Expected {}, got {}",
path.as_str().unwrap(), other.as_str().unwrap(), exp,
res.as_ref().and_then(|x| x.as_str()));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册