rust/src/test/run-pass/test-ignore-cfg.rs

31 lines
622 B
Rust

// compile-flags: --test --cfg ignorecfg
// xfail-fast
// xfail-pretty
use std;
import option;
import vec;
#[test]
#[ignore(cfg(ignorecfg))]
fn shouldignore() {
}
#[test]
#[ignore(cfg(noignorecfg))]
fn shouldnotignore() {
}
#[test]
fn checktests() {
// Pull the tests out of the secret test module
let tests = __test::tests();
let shouldignore = option::get(
vec::find(tests, {|t| t.name == "shouldignore"}));
assert shouldignore.ignore == true;
let shouldnotignore = option::get(
vec::find(tests, {|t| t.name == "shouldnotignore"}));
assert shouldnotignore.ignore == false;
}