Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
65cca7c8
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
65cca7c8
编写于
8月 03, 2014
作者:
S
Steven Fackler
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deprecate `#[ignore(cfg(...))]`
Replace `#[ignore(cfg(a, b))]` with `#[cfg_attr(all(a, b), ignore)]`
上级
e520bb1b
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
28 addition
and
20 deletion
+28
-20
src/doc/guide-testing.md
src/doc/guide-testing.md
+2
-2
src/libnative/io/file_unix.rs
src/libnative/io/file_unix.rs
+1
-1
src/libnum/complex.rs
src/libnum/complex.rs
+1
-1
src/librustuv/net.rs
src/librustuv/net.rs
+1
-1
src/libserialize/json.rs
src/libserialize/json.rs
+3
-3
src/libstd/dynamic_lib.rs
src/libstd/dynamic_lib.rs
+1
-2
src/libstd/io/net/pipe.rs
src/libstd/io/net/pipe.rs
+1
-1
src/libstd/io/net/tcp.rs
src/libstd/io/net/tcp.rs
+1
-1
src/libstd/io/net/udp.rs
src/libstd/io/net/udp.rs
+1
-1
src/libstd/num/f32.rs
src/libstd/num/f32.rs
+1
-1
src/libstd/num/f64.rs
src/libstd/num/f64.rs
+1
-1
src/libsync/deque.rs
src/libsync/deque.rs
+1
-1
src/libsyntax/test.rs
src/libsyntax/test.rs
+6
-0
src/libtest/lib.rs
src/libtest/lib.rs
+1
-2
src/libtime/lib.rs
src/libtime/lib.rs
+1
-1
src/test/run-pass/cfg_attr.rs
src/test/run-pass/cfg_attr.rs
+4
-0
src/test/run-pass/tcp-connect-timeouts.rs
src/test/run-pass/tcp-connect-timeouts.rs
+1
-1
未找到文件。
src/doc/guide-testing.md
浏览文件 @
65cca7c8
...
...
@@ -72,8 +72,8 @@ is not used.
Tests that should not be run can be annotated with the
`ignore`
attribute. The existence of these tests will be noted in the test
runner output, but the test will not be run. Tests can also be ignored
by configuration
so, for example, to ignore a test on windows you can
write
`#[ignore(cfg(target_os = "win32")
)]`
.
by configuration
using the
`cfg_attr`
attribute so, for example, to ignore a
test on windows you can write
`#[cfg_attr(windows, ignore
)]`
.
Tests that are intended to fail can be annotated with the
`should_fail`
attribute. The test will be run, and if it causes its
...
...
src/libnative/io/file_unix.rs
浏览文件 @
65cca7c8
...
...
@@ -506,7 +506,7 @@ mod tests {
use
std
::
os
;
use
std
::
rt
::
rtio
::{
RtioFileStream
,
SeekSet
};
#[
ignore(cfg(target_os
=
"freebsd"
)
)]
// hmm, maybe pipes have a tiny buffer
#[
cfg_attr(target_os
=
"freebsd"
,
ignore
)]
// hmm, maybe pipes have a tiny buffer
#[test]
fn
test_file_desc
()
{
// Run this test with some pipes so we don't have to mess around with
...
...
src/libnum/complex.rs
浏览文件 @
65cca7c8
...
...
@@ -219,7 +219,7 @@ fn test(c : Complex64, r : f64, i: f64) {
}
#[test]
#[
ignore(cfg(target_arch
=
"x86"
)
)]
#[
cfg_attr(target_arch
=
"x86"
,
ignore
)]
// FIXME #7158: (maybe?) currently failing on x86.
fn
test_norm
()
{
fn
test
(
c
:
Complex64
,
ns
:
f64
)
{
...
...
src/librustuv/net.rs
浏览文件 @
65cca7c8
...
...
@@ -1085,7 +1085,7 @@ fn test_read_read_read() {
}
#[test]
#[
ignore(cfg(windows)
)]
// FIXME(#10102) server never sees second packet
#[
cfg_attr(windows,
ignore
)]
// FIXME(#10102) server never sees second packet
fn
test_udp_twice
()
{
let
server_addr
=
::
next_test_ip4
();
let
client_addr
=
::
next_test_ip4
();
...
...
src/libserialize/json.rs
浏览文件 @
65cca7c8
...
...
@@ -3352,7 +3352,7 @@ fn assert_stream_equal(src: &str,
}
}
#[test]
#[
ignore(cfg(target_word_size
=
"32"
)
)]
// FIXME(#14064)
#[
cfg_attr(target_word_size
=
"32"
,
ignore
)]
// FIXME(#14064)
fn
test_streaming_parser
()
{
assert_stream_equal
(
r#"{ "foo":"bar", "array" : [0, 1, 2, 3, 4, 5], "idents":[null,true,false]}"#
,
...
...
@@ -3388,7 +3388,7 @@ fn last_event(src: &str) -> JsonEvent {
}
#[test]
#[
ignore(cfg(target_word_size
=
"32"
)
)]
// FIXME(#14064)
#[
cfg_attr(target_word_size
=
"32"
,
ignore
)]
// FIXME(#14064)
fn
test_read_object_streaming
()
{
assert_eq!
(
last_event
(
"{ "
),
Error
(
SyntaxError
(
EOFWhileParsingObject
,
1
,
3
)));
assert_eq!
(
last_event
(
"{1"
),
Error
(
SyntaxError
(
KeyMustBeAString
,
1
,
2
)));
...
...
@@ -3461,7 +3461,7 @@ fn test_read_object_streaming() {
);
}
#[test]
#[
ignore(cfg(target_word_size
=
"32"
)
)]
// FIXME(#14064)
#[
cfg_attr(target_word_size
=
"32"
,
ignore
)]
// FIXME(#14064)
fn
test_read_list_streaming
()
{
assert_stream_equal
(
"[]"
,
...
...
src/libstd/dynamic_lib.rs
浏览文件 @
65cca7c8
...
...
@@ -162,8 +162,7 @@ mod test {
use
mem
;
#[test]
#[ignore(cfg(windows))]
// FIXME #8818
#[ignore(cfg(target_os=
"android"
))]
// FIXME(#10379)
#[cfg_attr(any(windows,
target_os
=
"android"
),
ignore)]
// FIXME #8818, #10379
fn
test_loading_cosine
()
{
// The math library does not need to be loaded since it is already
// statically linked in
...
...
src/libstd/io/net/pipe.rs
浏览文件 @
65cca7c8
...
...
@@ -320,7 +320,7 @@ pub fn smalltest(server: proc(UnixStream):Send, client: proc(UnixStream):Send) {
},
proc
(
_
client
)
{
// drop the client
})
}
#[
ignore(cfg(windows)
)]
)
// FIXME(#12516)
}
#[
cfg_attr(windows,
ignore
)]
)
// FIXME(#12516)
iotest!
(
fn
write_begone
()
{
smalltest
(
proc
(
mut
server
)
{
...
...
src/libstd/io/net/tcp.rs
浏览文件 @
65cca7c8
...
...
@@ -533,7 +533,7 @@ mod test {
Ok
(
..
)
=>
fail!
(),
Err
(
e
)
=>
assert_eq!
(
e
.kind
,
PermissionDenied
),
}
}
#[
ignore(cfg(windows))]
#[ignore(cfg(target_os
=
"android"
)
)]
)
}
#[
cfg_attr(any(windows,
target_os
=
"android"
),
ignore
)]
)
iotest!
(
fn
connect_error
()
{
match
TcpStream
::
connect
(
"0.0.0.0"
,
1
)
{
...
...
src/libstd/io/net/udp.rs
浏览文件 @
65cca7c8
...
...
@@ -273,7 +273,7 @@ mod test {
Ok
(
..
)
=>
fail!
(),
Err
(
e
)
=>
assert_eq!
(
e
.kind
,
PermissionDenied
),
}
}
#[
ignore(cfg(windows))]
#[ignore(cfg(target_os
=
"android"
)
)]
)
}
#[
cfg_attr(any(windows,
target_os
=
"android"
),
ignore
)]
)
iotest!
(
fn
socket_smoke_test_ip4
()
{
let
server_ip
=
next_test_ip4
();
...
...
src/libstd/num/f32.rs
浏览文件 @
65cca7c8
...
...
@@ -766,7 +766,7 @@ fn test_frexp() {
assert_eq!
((
-
0f32
)
.frexp
(),
(
-
0f32
,
0
));
}
#[test]
#[
ignore(cfg(windows)
)]
// FIXME #8755
#[test]
#[
cfg_attr(windows,
ignore
)]
// FIXME #8755
fn
test_frexp_nowin
()
{
let
inf
:
f32
=
Float
::
infinity
();
let
neg_inf
:
f32
=
Float
::
neg_infinity
();
...
...
src/libstd/num/f64.rs
浏览文件 @
65cca7c8
...
...
@@ -768,7 +768,7 @@ fn test_frexp() {
assert_eq!
((
-
0f64
)
.frexp
(),
(
-
0f64
,
0
));
}
#[test]
#[
ignore(cfg(windows)
)]
// FIXME #8755
#[test]
#[
cfg_attr(windows,
ignore
)]
// FIXME #8755
fn
test_frexp_nowin
()
{
let
inf
:
f64
=
Float
::
infinity
();
let
neg_inf
:
f64
=
Float
::
neg_infinity
();
...
...
src/libsync/deque.rs
浏览文件 @
65cca7c8
...
...
@@ -600,7 +600,7 @@ fn stress() {
}
#[test]
#[
ignore(cfg(windows)
)]
// apparently windows scheduling is weird?
#[
cfg_attr(windows,
ignore
)]
// apparently windows scheduling is weird?
fn
no_starvation
()
{
static
AMT
:
int
=
10000
;
static
NTHREADS
:
int
=
4
;
...
...
src/libsyntax/test.rs
浏览文件 @
65cca7c8
...
...
@@ -339,6 +339,12 @@ fn is_ignored(cx: &TestCtxt, i: &ast::Item) -> bool {
// check ignore(cfg(foo, bar))
attr
.check_name
(
"ignore"
)
&&
match
attr
.meta_item_list
()
{
Some
(
ref
cfgs
)
=>
{
if
cfgs
.iter
()
.any
(|
cfg
|
cfg
.check_name
(
"cfg"
))
{
cx
.sess
.span_warn
(
attr
.span
,
"The use of cfg filters in #[ignore] is
\
deprecated. Use #[cfg_attr(<cfg pattern>,
\
ignore)] instead."
);
}
attr
::
test_cfg
(
cx
.config
.as_slice
(),
cfgs
.iter
())
}
None
=>
true
...
...
src/libtest/lib.rs
浏览文件 @
65cca7c8
...
...
@@ -356,8 +356,7 @@ fn usage(binary: &str) {
#[ignore] - When applied to a function which is already attributed as a
test, then the test runner will ignore these tests during
normal test runs. Running with --ignored will run these
tests. This may also be written as #[ignore(cfg(...))] to
ignore the test on certain configurations."
,
tests."
,
usage
=
getopts
::
usage
(
message
.as_slice
(),
optgroups
()
.as_slice
()));
}
...
...
src/libtime/lib.rs
浏览文件 @
65cca7c8
...
...
@@ -1564,7 +1564,7 @@ fn test_timespec_sub() {
}
#[test]
#[
ignore(cfg(target_os
=
"android"
)
)]
// FIXME #10958
#[
cfg_attr(target_os
=
"android"
,
ignore
)]
// FIXME #10958
fn
run_tests
()
{
// The tests race on tzset. So instead of having many independent
// tests, we will just call the functions now.
...
...
src/test/run-pass/cfg_attr.rs
浏览文件 @
65cca7c8
...
...
@@ -44,6 +44,9 @@
#[cfg_attr(any(notset,
not(any(set1,
notset))),
deriving(Show))]
struct
ComplexNot
(
NotShowable
);
#[cfg_attr(any(target_endian
=
"little"
,
target_endian
=
"big"
),
deriving(Show))]
struct
KeyValue
;
fn
is_show
<
T
:
Show
>
()
{}
fn
main
()
{
...
...
@@ -52,4 +55,5 @@ fn main() {
is_show
::
<
AllSet1Set2
>
();
is_show
::
<
AnySet1Notset
>
();
is_show
::
<
Complex
>
();
is_show
::
<
KeyValue
>
();
}
src/test/run-pass/tcp-connect-timeouts.rs
浏览文件 @
65cca7c8
...
...
@@ -80,7 +80,7 @@ fn f() $b
}
}
fail!
(
"never timed out!"
);
}
#[
ignore(cfg(target_os
=
"freebsd"
)
)]
)
}
#[
cfg_attr(target_os
=
"freebsd"
,
ignore
)]
)
iotest!
(
fn
timeout_success
()
{
let
addr
=
next_test_ip4
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录