diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-07-16 17:04:20 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-07-16 17:58:32 -0700 |
| commit | 64d43be6471b682037fb1dce13cdb3ea14ddc983 (patch) | |
| tree | da91d6a809160493303834f77dc70df53750ac17 /src/test/stdtest | |
| parent | f010f79a6164beab6a3cf920d325b2fb854e1b49 (diff) | |
| download | rust-64d43be6471b682037fb1dce13cdb3ea14ddc983.tar.gz rust-64d43be6471b682037fb1dce13cdb3ea14ddc983.zip | |
Sort tests before running them. Issue #428
Diffstat (limited to 'src/test/stdtest')
| -rw-r--r-- | src/test/stdtest/test.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/stdtest/test.rs b/src/test/stdtest/test.rs index f2d8df4e4ed..8ef20ece2db 100644 --- a/src/test/stdtest/test.rs +++ b/src/test/stdtest/test.rs @@ -66,6 +66,51 @@ fn filter_for_ignored_option() { assert filtered.(0).ignore == false; } +#[test] +fn sort_tests() { + auto opts = rec(filter = option::none, + run_ignored = false); + + auto names = ~["sha1::test", + "int::test_to_str", + "int::test_pow", + "test::do_not_run_ignored_tests", + "test::ignored_tests_result_in_ignored", + "test::first_free_arg_should_be_a_filter", + "test::parse_ignored_flag", + "test::filter_for_ignored_option", + "test::sort_tests"]; + auto tests = { + auto testfn = fn() {}; + auto tests = ~[]; + for (str name in names) { + auto test = rec(name = name, + fn = testfn, + ignore = false); + tests += ~[test]; + } + tests + }; + auto filtered = test::filter_tests(opts, tests); + + auto expected = ~["int::test_pow", + "int::test_to_str", + "sha1::test", + "test::do_not_run_ignored_tests", + "test::filter_for_ignored_option", + "test::first_free_arg_should_be_a_filter", + "test::ignored_tests_result_in_ignored", + "test::parse_ignored_flag", + "test::sort_tests"]; + + auto pairs = ivec::zip(expected, filtered); + + for (tup(str, test::test_desc) p in pairs) { + log_err #fmt("e: %s a: %s", p._0, p._1.name); + assert p._0 == p._1.name; + } +} + // Local Variables: // mode: rust; // fill-column: 78; |
