Skip to content

Commit f6f3228

Browse files
committed
rename option to run all tests and make it unstable
new name: --include-ignored requires -Zunstable-options
1 parent 9adf26a commit f6f3228

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

src/libtest/lib.rs

+20-12
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ pub type OptRes = Result<TestOpts, String>;
398398

399399
fn optgroups() -> getopts::Options {
400400
let mut opts = getopts::Options::new();
401-
opts.optflag("", "all", "Run ignored and not ignored tests")
401+
opts.optflag("", "include-ignored", "Run ignored and not ignored tests")
402402
.optflag("", "ignored", "Run only ignored tests")
403403
.optflag("", "test", "Run tests and not benchmarks")
404404
.optflag("", "bench", "Run benchmarks instead of tests")
@@ -498,7 +498,7 @@ Test Attributes:
498498
contain: #[should_panic(expected = "foo")].
499499
#[ignore] - When applied to a function which is already attributed as a
500500
test, then the test runner will ignore these tests during
501-
normal test runs. Running with --ignored or --all will run
501+
normal test runs. Running with --ignored or --include-ignored will run
502502
these tests."#,
503503
usage = options.usage(&message)
504504
);
@@ -552,9 +552,16 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
552552
None
553553
};
554554

555-
let run_ignored = match (matches.opt_present("all"), matches.opt_present("ignored")) {
555+
let include_ignored = matches.opt_present("include-ignored");
556+
if !allow_unstable && include_ignored {
557+
return Some(Err(
558+
"The \"include-ignored\" flag is only accepted on the nightly compiler".into()
559+
));
560+
}
561+
562+
let run_ignored = match (include_ignored, matches.opt_present("ignored")) {
556563
(true, true) => return Some(Err(
557-
"the options --all and --ignored are mutually exclusive".into()
564+
"the options --include-ignored and --ignored are mutually exclusive".into()
558565
)),
559566
(true, false) => RunIgnored::Yes,
560567
(false, true) => RunIgnored::Only,
@@ -1890,11 +1897,12 @@ mod tests {
18901897
}
18911898

18921899
#[test]
1893-
fn parse_all_flag() {
1900+
fn parse_include_ignored_flag() {
18941901
let args = vec![
18951902
"progname".to_string(),
18961903
"filter".to_string(),
1897-
"--all".to_string(),
1904+
"-Zunstable-options".to_string(),
1905+
"--include-ignored".to_string(),
18981906
];
18991907
let opts = parse_opts(&args).unwrap().unwrap();
19001908
assert_eq!(opts.run_ignored, RunIgnored::Yes);
@@ -1918,8 +1926,8 @@ mod tests {
19181926
}
19191927

19201928
#[test]
1921-
pub fn run_all_option() {
1922-
// When we run "--all" tests, the ignore flag should be set to false on
1929+
pub fn run_include_ignored_option() {
1930+
// When we "--include-ignored" tests, the ignore flag should be set to false on
19231931
// all tests and no test filtered out
19241932

19251933
let mut opts = TestOpts::new();
@@ -2041,9 +2049,9 @@ mod tests {
20412049
"test::ignored_tests_result_in_ignored".to_string(),
20422050
"test::first_free_arg_should_be_a_filter".to_string(),
20432051
"test::parse_ignored_flag".to_string(),
2044-
"test::parse_all_flag".to_string(),
2052+
"test::parse_include_ignored_flag".to_string(),
20452053
"test::filter_for_ignored_option".to_string(),
2046-
"test::run_all_option".to_string(),
2054+
"test::run_include_ignored_option".to_string(),
20472055
"test::sort_tests".to_string(),
20482056
];
20492057
let tests = {
@@ -2073,9 +2081,9 @@ mod tests {
20732081
"test::filter_for_ignored_option".to_string(),
20742082
"test::first_free_arg_should_be_a_filter".to_string(),
20752083
"test::ignored_tests_result_in_ignored".to_string(),
2076-
"test::parse_all_flag".to_string(),
20772084
"test::parse_ignored_flag".to_string(),
2078-
"test::run_all_option".to_string(),
2085+
"test::parse_include_ignored_flag".to_string(),
2086+
"test::run_include_ignored_option".to_string(),
20792087
"test::sort_tests".to_string(),
20802088
];
20812089

0 commit comments

Comments
 (0)