Add a facility for ignoring tests. Issue #428

Adding the #[ignore] attribute will cause the test not to be run, though it
will still show up in the list of tests.
This commit is contained in:
Brian Anderson 2011-07-14 11:29:54 -07:00
parent 49da7da441
commit b3dee95514
4 changed files with 120 additions and 25 deletions

View file

@ -2,6 +2,7 @@ use std;
mod sha1;
mod int;
mod test;
// Local Variables:
// mode: rust
// fill-column: 78;

36
src/test/stdtest/test.rs Normal file
View file

@ -0,0 +1,36 @@
import std::test;
#[test]
fn do_not_run_ignored_tests() {
auto ran = @mutable false;
auto f = bind fn(@mutable bool ran) {
*ran = true;
} (ran);
auto desc = rec(name = "whatever",
fn = f,
ignore = true);
auto res = test::run_test(desc);
assert ran == false;
}
#[test]
fn ignored_tests_result_in_ignored() {
fn f() { }
auto desc = rec(name = "whatever",
fn = f,
ignore = true);
auto res = test::run_test(desc);
assert res == test::tr_ignored;
}
// Local Variables:
// mode: rust;
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End: