Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3bab3dc5
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3bab3dc5
编写于
10月 15, 2014
作者:
L
Luqman Aden
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libstd: Remove all uses of {:?}.
上级
814586be
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
26 addition
and
26 deletion
+26
-26
src/libstd/dynamic_lib.rs
src/libstd/dynamic_lib.rs
+1
-1
src/libstd/io/fs.rs
src/libstd/io/fs.rs
+1
-1
src/libstd/io/net/pipe.rs
src/libstd/io/net/pipe.rs
+1
-1
src/libstd/os.rs
src/libstd/os.rs
+5
-5
src/libstd/path/posix.rs
src/libstd/path/posix.rs
+6
-6
src/libstd/path/windows.rs
src/libstd/path/windows.rs
+12
-12
未找到文件。
src/libstd/dynamic_lib.rs
浏览文件 @
3bab3dc5
...
@@ -183,7 +183,7 @@ fn test_loading_cosine() {
...
@@ -183,7 +183,7 @@ fn test_loading_cosine() {
let
expected_result
=
1.0
;
let
expected_result
=
1.0
;
let
result
=
cosine
(
argument
);
let
result
=
cosine
(
argument
);
if
result
!=
expected_result
{
if
result
!=
expected_result
{
fail
!
(
"cos({
:?}) != {:?} but equaled {:?
} instead"
,
argument
,
fail
!
(
"cos({
}) != {} but equaled {
} instead"
,
argument
,
expected_result
,
result
)
expected_result
,
result
)
}
}
}
}
...
...
src/libstd/io/fs.rs
浏览文件 @
3bab3dc5
...
@@ -963,7 +963,7 @@ mod test {
...
@@ -963,7 +963,7 @@ mod test {
macro_rules!
error
(
(
$e:expr
,
$s:expr
)
=>
(
macro_rules!
error
(
(
$e:expr
,
$s:expr
)
=>
(
match
$e
{
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
()),
Err
(
ref
err
)
=>
assert!
(
err
.to_string
()
.as_slice
()
.contains
(
$s
.as_slice
()),
format!
(
"`{}` did not contain `{}`"
,
err
,
$s
))
format!
(
"`{}` did not contain `{}`"
,
err
,
$s
))
}
}
...
...
src/libstd/io/net/pipe.rs
浏览文件 @
3bab3dc5
...
@@ -340,7 +340,7 @@ fn write_begone() {
...
@@ -340,7 +340,7 @@ fn write_begone() {
assert
!
(
e
.kind
==
BrokenPipe
||
assert
!
(
e
.kind
==
BrokenPipe
||
e
.kind
==
NotConnected
||
e
.kind
==
NotConnected
||
e
.kind
==
ConnectionReset
,
e
.kind
==
ConnectionReset
,
"unknown error {
:?
}"
,
e
);
"unknown error {}"
,
e
);
break
;
break
;
}
}
}
}
...
...
src/libstd/os.rs
浏览文件 @
3bab3dc5
...
@@ -1975,7 +1975,7 @@ fn test_self_exe_name() {
...
@@ -1975,7 +1975,7 @@ fn test_self_exe_name() {
let
path
=
os
::
self_exe_name
();
let
path
=
os
::
self_exe_name
();
assert
!
(
path
.is_some
());
assert
!
(
path
.is_some
());
let
path
=
path
.unwrap
();
let
path
=
path
.unwrap
();
debug!
(
"{
:?}"
,
path
.clone
());
debug!
(
"{
}"
,
path
.display
());
// Hard to test this function
// Hard to test this function
assert
!
(
path
.is_absolute
());
assert
!
(
path
.is_absolute
());
...
@@ -1986,7 +1986,7 @@ fn test_self_exe_path() {
...
@@ -1986,7 +1986,7 @@ fn test_self_exe_path() {
let
path
=
os
::
self_exe_path
();
let
path
=
os
::
self_exe_path
();
assert
!
(
path
.is_some
());
assert
!
(
path
.is_some
());
let
path
=
path
.unwrap
();
let
path
=
path
.unwrap
();
debug!
(
"{
:?}"
,
path
.clone
());
debug!
(
"{
}"
,
path
.display
());
// Hard to test this function
// Hard to test this function
assert
!
(
path
.is_absolute
());
assert
!
(
path
.is_absolute
());
...
@@ -1999,7 +1999,7 @@ fn test_env_getenv() {
...
@@ -1999,7 +1999,7 @@ fn test_env_getenv() {
assert
!
(
e
.len
()
>
0u
);
assert
!
(
e
.len
()
>
0u
);
for
p
in
e
.iter
()
{
for
p
in
e
.iter
()
{
let
(
n
,
v
)
=
(
*
p
)
.clone
();
let
(
n
,
v
)
=
(
*
p
)
.clone
();
debug!
(
"{
:?}"
,
n
.clone
()
);
debug!
(
"{
}"
,
n
);
let
v2
=
getenv
(
n
.as_slice
());
let
v2
=
getenv
(
n
.as_slice
());
// MingW seems to set some funky environment variables like
// MingW seems to set some funky environment variables like
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
...
@@ -2037,8 +2037,8 @@ fn test() {
...
@@ -2037,8 +2037,8 @@ fn test() {
let
cwd
=
getcwd
();
let
cwd
=
getcwd
();
debug!
(
"Current working directory: {}"
,
cwd
.display
());
debug!
(
"Current working directory: {}"
,
cwd
.display
());
debug!
(
"{
:?}"
,
make_absolute
(
&
Path
::
new
(
"test-path"
)
));
debug!
(
"{
}"
,
make_absolute
(
&
Path
::
new
(
"test-path"
))
.display
(
));
debug!
(
"{
:?}"
,
make_absolute
(
&
Path
::
new
(
"/usr/bin"
)
));
debug!
(
"{
}"
,
make_absolute
(
&
Path
::
new
(
"/usr/bin"
))
.display
(
));
}
}
#[test]
#[test]
...
...
src/libstd/path/posix.rs
浏览文件 @
3bab3dc5
...
@@ -986,19 +986,19 @@ fn test_getters() {
...
@@ -986,19 +986,19 @@ fn test_getters() {
let
path
=
$path
;
let
path
=
$path
;
let
filename
=
$filename
;
let
filename
=
$filename
;
assert!
(
path
.filename_str
()
==
filename
,
assert!
(
path
.filename_str
()
==
filename
,
"{}.filename_str(): Expected `{
:?}`, found {:?
}"
,
"{}.filename_str(): Expected `{
}`, found {
}"
,
path
.as_str
()
.unwrap
(),
filename
,
path
.filename_str
());
path
.as_str
()
.unwrap
(),
filename
,
path
.filename_str
());
let
dirname
=
$dirname
;
let
dirname
=
$dirname
;
assert!
(
path
.dirname_str
()
==
dirname
,
assert!
(
path
.dirname_str
()
==
dirname
,
"`{}`.dirname_str(): Expected `{
:?}`, found `{:?
}`"
,
"`{}`.dirname_str(): Expected `{
}`, found `{
}`"
,
path
.as_str
()
.unwrap
(),
dirname
,
path
.dirname_str
());
path
.as_str
()
.unwrap
(),
dirname
,
path
.dirname_str
());
let
filestem
=
$filestem
;
let
filestem
=
$filestem
;
assert!
(
path
.filestem_str
()
==
filestem
,
assert!
(
path
.filestem_str
()
==
filestem
,
"`{}`.filestem_str(): Expected `{
:?}`, found `{:?
}`"
,
"`{}`.filestem_str(): Expected `{
}`, found `{
}`"
,
path
.as_str
()
.unwrap
(),
filestem
,
path
.filestem_str
());
path
.as_str
()
.unwrap
(),
filestem
,
path
.filestem_str
());
let
ext
=
$ext
;
let
ext
=
$ext
;
assert!
(
path
.extension_str
()
==
mem
::
transmute
(
ext
),
assert!
(
path
.extension_str
()
==
mem
::
transmute
(
ext
),
"`{}`.extension_str(): Expected `{
:?}`, found `{:?
}`"
,
"`{}`.extension_str(): Expected `{
}`, found `{
}`"
,
path
.as_str
()
.unwrap
(),
ext
,
path
.extension_str
());
path
.as_str
()
.unwrap
(),
ext
,
path
.extension_str
());
}
}
}
}
...
@@ -1200,11 +1200,11 @@ fn test_components_iter() {
...
@@ -1200,11 +1200,11 @@ fn test_components_iter() {
let
comps
=
path
.components
()
.collect
::
<
Vec
<&
[
u8
]
>>
();
let
comps
=
path
.components
()
.collect
::
<
Vec
<&
[
u8
]
>>
();
let
exp
:
&
[
&
str
]
=
$exp
;
let
exp
:
&
[
&
str
]
=
$exp
;
let
exps
=
exp
.iter
()
.map
(|
x
|
x
.as_bytes
())
.collect
::
<
Vec
<&
[
u8
]
>>
();
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
);
comps
,
exps
);
let
comps
=
path
.components
()
.rev
()
.collect
::
<
Vec
<&
[
u8
]
>>
();
let
comps
=
path
.components
()
.rev
()
.collect
::
<
Vec
<&
[
u8
]
>>
();
let
exps
=
exps
.into_iter
()
.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
);
comps
,
exps
);
}
}
);
);
...
...
src/libstd/path/windows.rs
浏览文件 @
3bab3dc5
...
@@ -996,7 +996,7 @@ pub fn is_sep_byte_verbatim(u: &u8) -> bool {
...
@@ -996,7 +996,7 @@ pub fn is_sep_byte_verbatim(u: &u8) -> bool {
}
}
/// Prefix types for Path
/// Prefix types for Path
#[deriving(PartialEq,
Clone)]
#[deriving(PartialEq,
Clone
,
Show
)]
pub
enum
PathPrefix
{
pub
enum
PathPrefix
{
/// Prefix `\\?\`, uint is the length of the following component
/// Prefix `\\?\`, uint is the length of the following component
VerbatimPrefix
(
uint
),
VerbatimPrefix
(
uint
),
...
@@ -1172,7 +1172,7 @@ fn test_parse_prefix() {
...
@@ -1172,7 +1172,7 @@ fn test_parse_prefix() {
let
exp
=
$exp
;
let
exp
=
$exp
;
let
res
=
parse_prefix
(
path
);
let
res
=
parse_prefix
(
path
);
assert!
(
res
==
exp
,
assert!
(
res
==
exp
,
"parse_prefix(
\"
{}
\"
): expected {
:?}, found {:?
}"
,
path
,
exp
,
res
);
"parse_prefix(
\"
{}
\"
): expected {
}, found {
}"
,
path
,
exp
,
res
);
}
}
)
)
)
)
...
@@ -1904,19 +1904,19 @@ fn test_getters() {
...
@@ -1904,19 +1904,19 @@ fn test_getters() {
let
path
=
$path
;
let
path
=
$path
;
let
filename
=
$filename
;
let
filename
=
$filename
;
assert!
(
path
.filename_str
()
==
filename
,
assert!
(
path
.filename_str
()
==
filename
,
"`{}`.filename_str(): Expected `{
:?}`, found `{:?
}`"
,
"`{}`.filename_str(): Expected `{
}`, found `{
}`"
,
path
.as_str
()
.unwrap
(),
filename
,
path
.filename_str
());
path
.as_str
()
.unwrap
(),
filename
,
path
.filename_str
());
let
dirname
=
$dirname
;
let
dirname
=
$dirname
;
assert!
(
path
.dirname_str
()
==
dirname
,
assert!
(
path
.dirname_str
()
==
dirname
,
"`{}`.dirname_str(): Expected `{
:?}`, found `{:?
}`"
,
"`{}`.dirname_str(): Expected `{
}`, found `{
}`"
,
path
.as_str
()
.unwrap
(),
dirname
,
path
.dirname_str
());
path
.as_str
()
.unwrap
(),
dirname
,
path
.dirname_str
());
let
filestem
=
$filestem
;
let
filestem
=
$filestem
;
assert!
(
path
.filestem_str
()
==
filestem
,
assert!
(
path
.filestem_str
()
==
filestem
,
"`{}`.filestem_str(): Expected `{
:?}`, found `{:?
}`"
,
"`{}`.filestem_str(): Expected `{
}`, found `{
}`"
,
path
.as_str
()
.unwrap
(),
filestem
,
path
.filestem_str
());
path
.as_str
()
.unwrap
(),
filestem
,
path
.filestem_str
());
let
ext
=
$ext
;
let
ext
=
$ext
;
assert!
(
path
.extension_str
()
==
mem
::
transmute
(
ext
),
assert!
(
path
.extension_str
()
==
mem
::
transmute
(
ext
),
"`{}`.extension_str(): Expected `{
:?}`, found `{:?
}`"
,
"`{}`.extension_str(): Expected `{
}`, found `{
}`"
,
path
.as_str
()
.unwrap
(),
ext
,
path
.extension_str
());
path
.as_str
()
.unwrap
(),
ext
,
path
.extension_str
());
}
}
}
}
...
@@ -1974,16 +1974,16 @@ fn test_is_absolute() {
...
@@ -1974,16 +1974,16 @@ fn test_is_absolute() {
let
path
=
Path
::
new
(
$path
);
let
path
=
Path
::
new
(
$path
);
let
(
abs
,
vol
,
cwd
,
rel
)
=
(
$abs
,
$vol
,
$cwd
,
$rel
);
let
(
abs
,
vol
,
cwd
,
rel
)
=
(
$abs
,
$vol
,
$cwd
,
$rel
);
let
b
=
path
.is_absolute
();
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
);
path
.as_str
()
.unwrap
(),
abs
,
b
);
let
b
=
is_vol_relative
(
&
path
);
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
);
path
.as_str
()
.unwrap
(),
vol
,
b
);
let
b
=
is_cwd_relative
(
&
path
);
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
);
path
.as_str
()
.unwrap
(),
cwd
,
b
);
let
b
=
path
.is_relative
();
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
);
path
.as_str
()
.unwrap
(),
rel
,
b
);
}
}
)
)
...
@@ -2016,7 +2016,7 @@ fn test_is_ancestor_of() {
...
@@ -2016,7 +2016,7 @@ fn test_is_ancestor_of() {
let
exp
=
$exp
;
let
exp
=
$exp
;
let
res
=
path
.is_ancestor_of
(
&
dest
);
let
res
=
path
.is_ancestor_of
(
&
dest
);
assert!
(
res
==
exp
,
assert!
(
res
==
exp
,
"`{}`.is_ancestor_of(`{}`): Expected {
:?}, found {:?
}"
,
"`{}`.is_ancestor_of(`{}`): Expected {
}, found {
}"
,
path
.as_str
()
.unwrap
(),
dest
.as_str
()
.unwrap
(),
exp
,
res
);
path
.as_str
()
.unwrap
(),
dest
.as_str
()
.unwrap
(),
exp
,
res
);
}
}
)
)
...
@@ -2151,7 +2151,7 @@ fn test_path_relative_from() {
...
@@ -2151,7 +2151,7 @@ fn test_path_relative_from() {
let
res
=
path
.path_relative_from
(
&
other
);
let
res
=
path
.path_relative_from
(
&
other
);
let
exp
=
$exp
;
let
exp
=
$exp
;
assert!
(
res
.as_ref
()
.and_then
(|
x
|
x
.as_str
())
==
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
,
path
.as_str
()
.unwrap
(),
other
.as_str
()
.unwrap
(),
exp
,
res
.as_ref
()
.and_then
(|
x
|
x
.as_str
()));
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录