summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-10-29 17:35:45 -0700
committerBrian Anderson <banderson@mozilla.com>2011-10-29 18:30:32 -0700
commitf7ebe23ae185991b0fee05b32fbb3e29b89a41bf (patch)
tree1fb1114306acbbb0e70f3f418bde3dbcd76684a5 /src/test
parent2e0593d9999a50c74ea2962e53b8f5686037fd36 (diff)
downloadrust-f7ebe23ae185991b0fee05b32fbb3e29b89a41bf.tar.gz
rust-f7ebe23ae185991b0fee05b32fbb3e29b89a41bf.zip
Add the ability to ignore tests by compiler config
[test]
[ignore(cfg(target_os = "win32"))]
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/test-ignore-cfg.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/run-pass/test-ignore-cfg.rs b/src/test/run-pass/test-ignore-cfg.rs
new file mode 100644
index 00000000000..e88987bc2cb
--- /dev/null
+++ b/src/test/run-pass/test-ignore-cfg.rs
@@ -0,0 +1,31 @@
+// compile-flags: --test --cfg ignorecfg
+// xfail-fast
+// xfail-pretty
+
+use std;
+import std::option;
+import std::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({|t| t.name == "shouldignore"}, tests));
+    assert shouldignore.ignore == true;
+
+    let shouldnotignore = option::get(
+        vec::find({|t| t.name == "shouldnotignore"}, tests));
+    assert shouldnotignore.ignore == false;
+}
\ No newline at end of file