From 347ed001e81607f609f7c47a6d7cd5f723c288a1 Mon Sep 17 00:00:00 2001 From: Aliénore Bouttefeux Date: Mon, 3 May 2021 14:55:22 +0200 Subject: proof of concept add test type on prints --- library/test/src/formatters/pretty.rs | 2 +- library/test/src/formatters/terse.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'library/test/src/formatters') diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs index 5e41d6d9692..00d4b18b302 100644 --- a/library/test/src/formatters/pretty.rs +++ b/library/test/src/formatters/pretty.rs @@ -169,7 +169,7 @@ impl PrettyFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - self.write_plain(&format!("test {} ... ", name))?; + self.write_plain(&format!("test {} {} ... ", name, desc.test_mode_string()))?; Ok(()) } diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs index 6f46f7255a4..a68ceb404f9 100644 --- a/library/test/src/formatters/terse.rs +++ b/library/test/src/formatters/terse.rs @@ -158,7 +158,7 @@ impl TerseFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - self.write_plain(&format!("test {} ... ", name))?; + self.write_plain(&format!("test {} {} ... ", name, desc.test_mode_string()))?; Ok(()) } -- cgit 1.4.1-3-g733a5 From 6e99cb39899a4be7d5e1f6572d38486712c75786 Mon Sep 17 00:00:00 2001 From: Aliénore Bouttefeux Date: Mon, 3 May 2021 20:16:44 +0200 Subject: change based on review --- library/test/src/formatters/pretty.rs | 2 +- library/test/src/formatters/terse.rs | 2 +- library/test/src/types.rs | 16 ++++++++-------- src/test/rustdoc-ui/cfg-test.stdout | 4 ++-- src/test/rustdoc-ui/doc-test-doctest-feature.stdout | 2 +- src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout | 2 +- src/test/rustdoc-ui/doctest-output.stdout | 6 +++--- src/test/rustdoc-ui/failed-doctest-compile-fail.stdout | 2 +- src/test/rustdoc-ui/failed-doctest-missing-codes.stdout | 2 +- src/test/rustdoc-ui/failed-doctest-output.stdout | 4 ++-- src/test/rustdoc-ui/failed-doctest-should-panic.stdout | 2 +- src/test/rustdoc-ui/issue-80992.stdout | 2 +- src/test/rustdoc-ui/issue-81662-shortness.stdout | 2 +- src/test/rustdoc-ui/no-run-flag.stdout | 14 +++++++------- src/test/rustdoc-ui/run-directory.correct.stdout | 2 +- src/test/rustdoc-ui/run-directory.incorrect.stdout | 2 +- src/test/rustdoc-ui/test-no_std.stdout | 2 +- src/test/rustdoc-ui/test-type.stdout | 10 +++++----- src/test/rustdoc-ui/unparseable-doc-test.stdout | 2 +- src/test/ui/test-attrs/test-filter-multiple.run.stdout | 4 ++-- src/test/ui/test-attrs/test-type.run.stdout | 6 +++--- src/test/ui/test-panic-abort-nocapture.run.stdout | 8 ++++---- src/test/ui/test-panic-abort.run.stdout | 10 +++++----- src/test/ui/test-passed.run.stdout | 4 ++-- src/test/ui/test-thread-capture.run.stdout | 4 ++-- src/test/ui/test-thread-nocapture.run.stdout | 4 ++-- 26 files changed, 60 insertions(+), 60 deletions(-) (limited to 'library/test/src/formatters') diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs index 00d4b18b302..543b9a6924a 100644 --- a/library/test/src/formatters/pretty.rs +++ b/library/test/src/formatters/pretty.rs @@ -169,7 +169,7 @@ impl PrettyFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - self.write_plain(&format!("test {} {} ... ", name, desc.test_mode_string()))?; + self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode_string()))?; Ok(()) } diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs index a68ceb404f9..286b50b525d 100644 --- a/library/test/src/formatters/terse.rs +++ b/library/test/src/formatters/terse.rs @@ -158,7 +158,7 @@ impl TerseFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - self.write_plain(&format!("test {} {} ... ", name, desc.test_mode_string()))?; + self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode_string()))?; Ok(()) } diff --git a/library/test/src/types.rs b/library/test/src/types.rs index 61c644f7972..a2c3d5fa8ee 100644 --- a/library/test/src/types.rs +++ b/library/test/src/types.rs @@ -143,26 +143,26 @@ impl TestDesc { } } - pub fn test_mode_string(&self) -> String { + pub fn test_mode_string(&self) -> &'static str { if self.ignore { - return "ignore".to_string(); + return &"ignore"; } match self.should_panic { options::ShouldPanic::Yes | options::ShouldPanic::YesWithMessage(_) => { - return "should panic".to_string(); + return &"should panic"; } - _ => {} + options::ShouldPanic::No => {} } if self.allow_fail { - return "allow fail".to_string(); + return &"allow fail"; } if self.compile_fail { - return "compile fail".to_string(); + return &"compile fail"; } if self.no_run { - return "compile".to_string(); + return &"compile"; } - "run".to_string() + &"run" } } diff --git a/src/test/rustdoc-ui/cfg-test.stdout b/src/test/rustdoc-ui/cfg-test.stdout index fdd754609ef..42d3fbb48dd 100644 --- a/src/test/rustdoc-ui/cfg-test.stdout +++ b/src/test/rustdoc-ui/cfg-test.stdout @@ -1,7 +1,7 @@ running 2 tests -test $DIR/cfg-test.rs - Bar (line 27) run ... ok -test $DIR/cfg-test.rs - Foo (line 19) run ... ok +test $DIR/cfg-test.rs - Bar (line 27) - run ... ok +test $DIR/cfg-test.rs - Foo (line 19) - run ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/doc-test-doctest-feature.stdout b/src/test/rustdoc-ui/doc-test-doctest-feature.stdout index ecf5dcd056a..cfcb60332f4 100644 --- a/src/test/rustdoc-ui/doc-test-doctest-feature.stdout +++ b/src/test/rustdoc-ui/doc-test-doctest-feature.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/doc-test-doctest-feature.rs - Foo (line 9) run ... ok +test $DIR/doc-test-doctest-feature.rs - Foo (line 9) - run ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout index 7f900cb2858..8d7f1ad21d1 100644 --- a/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout +++ b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) run ... ok +test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) - run ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/doctest-output.stdout b/src/test/rustdoc-ui/doctest-output.stdout index 1b5857d251b..7a07d273e26 100644 --- a/src/test/rustdoc-ui/doctest-output.stdout +++ b/src/test/rustdoc-ui/doctest-output.stdout @@ -1,8 +1,8 @@ running 3 tests -test $DIR/doctest-output.rs - (line 8) run ... ok -test $DIR/doctest-output.rs - ExpandedStruct (line 24) run ... ok -test $DIR/doctest-output.rs - foo::bar (line 18) run ... ok +test $DIR/doctest-output.rs - (line 8) - run ... ok +test $DIR/doctest-output.rs - ExpandedStruct (line 24) - run ... ok +test $DIR/doctest-output.rs - foo::bar (line 18) - run ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout b/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout index dc811df609c..af3a90a7410 100644 --- a/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout +++ b/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/failed-doctest-compile-fail.rs - Foo (line 9) compile fail ... FAILED +test $DIR/failed-doctest-compile-fail.rs - Foo (line 9) - compile fail ... FAILED failures: diff --git a/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout b/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout index a76511eb29e..bacbb47b5f9 100644 --- a/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout +++ b/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/failed-doctest-missing-codes.rs - Foo (line 9) compile fail ... FAILED +test $DIR/failed-doctest-missing-codes.rs - Foo (line 9) - compile fail ... FAILED failures: diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout index 83c8c5301e0..7ba599ff11b 100644 --- a/src/test/rustdoc-ui/failed-doctest-output.stdout +++ b/src/test/rustdoc-ui/failed-doctest-output.stdout @@ -1,7 +1,7 @@ running 2 tests -test $DIR/failed-doctest-output.rs - OtherStruct (line 22) run ... FAILED -test $DIR/failed-doctest-output.rs - SomeStruct (line 12) run ... FAILED +test $DIR/failed-doctest-output.rs - OtherStruct (line 22) - run ... FAILED +test $DIR/failed-doctest-output.rs - SomeStruct (line 12) - run ... FAILED failures: diff --git a/src/test/rustdoc-ui/failed-doctest-should-panic.stdout b/src/test/rustdoc-ui/failed-doctest-should-panic.stdout index e3d0216441b..6bd21423e69 100644 --- a/src/test/rustdoc-ui/failed-doctest-should-panic.stdout +++ b/src/test/rustdoc-ui/failed-doctest-should-panic.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/failed-doctest-should-panic.rs - Foo (line 9) run ... FAILED +test $DIR/failed-doctest-should-panic.rs - Foo (line 9) - run ... FAILED failures: diff --git a/src/test/rustdoc-ui/issue-80992.stdout b/src/test/rustdoc-ui/issue-80992.stdout index e7110dee4fb..d2b1cd1d550 100644 --- a/src/test/rustdoc-ui/issue-80992.stdout +++ b/src/test/rustdoc-ui/issue-80992.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/issue-80992.rs - test (line 7) compile fail ... ok +test $DIR/issue-80992.rs - test (line 7) - compile fail ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/issue-81662-shortness.stdout b/src/test/rustdoc-ui/issue-81662-shortness.stdout index 3c2901e70f0..f9fdf7048d8 100644 --- a/src/test/rustdoc-ui/issue-81662-shortness.stdout +++ b/src/test/rustdoc-ui/issue-81662-shortness.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/issue-81662-shortness.rs - foo (line 6) run ... FAILED +test $DIR/issue-81662-shortness.rs - foo (line 6) - run ... FAILED failures: diff --git a/src/test/rustdoc-ui/no-run-flag.stdout b/src/test/rustdoc-ui/no-run-flag.stdout index 418691e4f0c..22d927317b3 100644 --- a/src/test/rustdoc-ui/no-run-flag.stdout +++ b/src/test/rustdoc-ui/no-run-flag.stdout @@ -1,12 +1,12 @@ running 7 tests -test $DIR/no-run-flag.rs - f (line 11) compile ... ok -test $DIR/no-run-flag.rs - f (line 14) ignore ... ignored -test $DIR/no-run-flag.rs - f (line 17) compile ... ok -test $DIR/no-run-flag.rs - f (line 23) compile fail ... ok -test $DIR/no-run-flag.rs - f (line 28) compile ... ok -test $DIR/no-run-flag.rs - f (line 32) compile ... ok -test $DIR/no-run-flag.rs - f (line 8) compile ... ok +test $DIR/no-run-flag.rs - f (line 11) - compile ... ok +test $DIR/no-run-flag.rs - f (line 14) - ignore ... ignored +test $DIR/no-run-flag.rs - f (line 17) - compile ... ok +test $DIR/no-run-flag.rs - f (line 23) - compile fail ... ok +test $DIR/no-run-flag.rs - f (line 28) - compile ... ok +test $DIR/no-run-flag.rs - f (line 32) - compile ... ok +test $DIR/no-run-flag.rs - f (line 8) - compile ... ok test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/run-directory.correct.stdout b/src/test/rustdoc-ui/run-directory.correct.stdout index a5bc41ece99..1bb84a868a4 100644 --- a/src/test/rustdoc-ui/run-directory.correct.stdout +++ b/src/test/rustdoc-ui/run-directory.correct.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/run-directory.rs - foo (line 10) run ... ok +test $DIR/run-directory.rs - foo (line 10) - run ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/run-directory.incorrect.stdout b/src/test/rustdoc-ui/run-directory.incorrect.stdout index 542043bc437..7f6bba8fe47 100644 --- a/src/test/rustdoc-ui/run-directory.incorrect.stdout +++ b/src/test/rustdoc-ui/run-directory.incorrect.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/run-directory.rs - foo (line 19) run ... ok +test $DIR/run-directory.rs - foo (line 19) - run ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/test-no_std.stdout b/src/test/rustdoc-ui/test-no_std.stdout index 82dbffcbd55..35d44fa6bbd 100644 --- a/src/test/rustdoc-ui/test-no_std.stdout +++ b/src/test/rustdoc-ui/test-no_std.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/test-no_std.rs - f (line 10) run ... ok +test $DIR/test-no_std.rs - f (line 10) - run ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/test-type.stdout b/src/test/rustdoc-ui/test-type.stdout index 8f36d643b2f..fb6c036a608 100644 --- a/src/test/rustdoc-ui/test-type.stdout +++ b/src/test/rustdoc-ui/test-type.stdout @@ -1,10 +1,10 @@ running 5 tests -test $DIR/test-type.rs - f (line 12) ignore ... ignored -test $DIR/test-type.rs - f (line 15) compile ... ok -test $DIR/test-type.rs - f (line 21) compile fail ... ok -test $DIR/test-type.rs - f (line 6) run ... ok -test $DIR/test-type.rs - f (line 9) run ... ok +test $DIR/test-type.rs - f (line 12) - ignore ... ignored +test $DIR/test-type.rs - f (line 15) - compile ... ok +test $DIR/test-type.rs - f (line 21) - compile fail ... ok +test $DIR/test-type.rs - f (line 6) - run ... ok +test $DIR/test-type.rs - f (line 9) - run ... ok test result: ok. 4 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/unparseable-doc-test.stdout b/src/test/rustdoc-ui/unparseable-doc-test.stdout index dbbb6541b97..13526acfc47 100644 --- a/src/test/rustdoc-ui/unparseable-doc-test.stdout +++ b/src/test/rustdoc-ui/unparseable-doc-test.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/unparseable-doc-test.rs - foo (line 7) run ... FAILED +test $DIR/unparseable-doc-test.rs - foo (line 7) - run ... FAILED failures: diff --git a/src/test/ui/test-attrs/test-filter-multiple.run.stdout b/src/test/ui/test-attrs/test-filter-multiple.run.stdout index 6389d7f998f..5d6d5cbd3c3 100644 --- a/src/test/ui/test-attrs/test-filter-multiple.run.stdout +++ b/src/test/ui/test-attrs/test-filter-multiple.run.stdout @@ -1,7 +1,7 @@ running 2 tests -test test1 run ... ok -test test2 run ... ok +test test1 - run ... ok +test test2 - run ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in $TIME diff --git a/src/test/ui/test-attrs/test-type.run.stdout b/src/test/ui/test-attrs/test-type.run.stdout index 5f10c784f89..9f789526615 100644 --- a/src/test/ui/test-attrs/test-type.run.stdout +++ b/src/test/ui/test-attrs/test-type.run.stdout @@ -1,8 +1,8 @@ running 3 tests -test test_no_run ignore ... ignored -test test_ok run ... ok -test test_panic should panic ... ok +test test_no_run - ignore ... ignored +test test_ok - run ... ok +test test_panic - should panic ... ok test result: ok. 2 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/ui/test-panic-abort-nocapture.run.stdout b/src/test/ui/test-panic-abort-nocapture.run.stdout index 29d5172ce8c..e335cf05153 100644 --- a/src/test/ui/test-panic-abort-nocapture.run.stdout +++ b/src/test/ui/test-panic-abort-nocapture.run.stdout @@ -1,12 +1,12 @@ running 4 tests -test it_fails run ... about to fail +test it_fails - run ... about to fail FAILED -test it_panics should panic ... about to panic +test it_panics - should panic ... about to panic ok -test it_works run ... about to succeed +test it_works - run ... about to succeed ok -test it_writes_to_stdio run ... hello, world +test it_writes_to_stdio - run ... hello, world testing123 ok diff --git a/src/test/ui/test-panic-abort.run.stdout b/src/test/ui/test-panic-abort.run.stdout index 2842f08f6cc..0d9de10c981 100644 --- a/src/test/ui/test-panic-abort.run.stdout +++ b/src/test/ui/test-panic-abort.run.stdout @@ -1,10 +1,10 @@ running 5 tests -test it_exits run ... FAILED -test it_fails run ... FAILED -test it_panics should panic ... ok -test it_works run ... ok -test no_residual_environment run ... ok +test it_exits - run ... FAILED +test it_fails - run ... FAILED +test it_panics - should panic ... ok +test it_works - run ... ok +test no_residual_environment - run ... ok failures: diff --git a/src/test/ui/test-passed.run.stdout b/src/test/ui/test-passed.run.stdout index cd4b0e466a3..995643a62c8 100644 --- a/src/test/ui/test-passed.run.stdout +++ b/src/test/ui/test-passed.run.stdout @@ -1,7 +1,7 @@ running 2 tests -test it_works run ... ok -test it_works_too run ... ok +test it_works - run ... ok +test it_works_too - run ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/ui/test-thread-capture.run.stdout b/src/test/ui/test-thread-capture.run.stdout index db9d90f20f2..ce9ec63b526 100644 --- a/src/test/ui/test-thread-capture.run.stdout +++ b/src/test/ui/test-thread-capture.run.stdout @@ -1,7 +1,7 @@ running 2 tests -test thready_fail run ... FAILED -test thready_pass run ... ok +test thready_fail - run ... FAILED +test thready_pass - run ... ok failures: diff --git a/src/test/ui/test-thread-nocapture.run.stdout b/src/test/ui/test-thread-nocapture.run.stdout index 42e6d40a4d1..bd1971ab7d3 100644 --- a/src/test/ui/test-thread-nocapture.run.stdout +++ b/src/test/ui/test-thread-nocapture.run.stdout @@ -1,11 +1,11 @@ running 2 tests -test thready_fail run ... fee +test thready_fail - run ... fee fie foe fum FAILED -test thready_pass run ... fee +test thready_pass - run ... fee fie foe fum -- cgit 1.4.1-3-g733a5 From f6b8b780633798477bf0b13e01bfec8e1ab76856 Mon Sep 17 00:00:00 2001 From: Aliénore Bouttefeux Date: Sun, 9 May 2021 13:37:09 +0200 Subject: add bootstrap cfg --- library/test/src/formatters/pretty.rs | 2 +- library/test/src/formatters/terse.rs | 2 +- library/test/src/tests.rs | 38 +++++++++++++++++++++++++++++++++++ library/test/src/types.rs | 10 ++++++++- src/librustdoc/doctest.rs | 2 ++ src/tools/compiletest/src/main.rs | 2 ++ 6 files changed, 53 insertions(+), 3 deletions(-) (limited to 'library/test/src/formatters') diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs index 543b9a6924a..c1a0bb9f3e1 100644 --- a/library/test/src/formatters/pretty.rs +++ b/library/test/src/formatters/pretty.rs @@ -169,7 +169,7 @@ impl PrettyFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode_string()))?; + self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode()))?; Ok(()) } diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs index 286b50b525d..a9589829ad2 100644 --- a/library/test/src/formatters/terse.rs +++ b/library/test/src/formatters/terse.rs @@ -158,7 +158,7 @@ impl TerseFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode_string()))?; + self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode()))?; Ok(()) } diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs index 794f7277004..5a4a540b04e 100644 --- a/library/test/src/tests.rs +++ b/library/test/src/tests.rs @@ -61,7 +61,9 @@ fn one_ignored_one_unignored_test() -> Vec { ignore: true, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -73,7 +75,9 @@ fn one_ignored_one_unignored_test() -> Vec { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -93,7 +97,9 @@ pub fn do_not_run_ignored_tests() { ignore: true, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -114,7 +120,9 @@ pub fn ignored_tests_result_in_ignored() { ignore: true, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -139,7 +147,9 @@ fn test_should_panic() { ignore: false, should_panic: ShouldPanic::Yes, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -164,7 +174,9 @@ fn test_should_panic_good_message() { ignore: false, should_panic: ShouldPanic::YesWithMessage("error message"), allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -194,7 +206,9 @@ fn test_should_panic_bad_message() { ignore: false, should_panic: ShouldPanic::YesWithMessage(expected), allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -228,7 +242,9 @@ fn test_should_panic_non_string_message_type() { ignore: false, should_panic: ShouldPanic::YesWithMessage(expected), allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -254,7 +270,9 @@ fn test_should_panic_but_succeeds() { ignore: false, should_panic, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -288,7 +306,9 @@ fn report_time_test_template(report_time: bool) -> Option { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -323,7 +343,9 @@ fn time_test_failure_template(test_type: TestType) -> TestResult { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type, }, @@ -362,7 +384,9 @@ fn typed_test_desc(test_type: TestType) -> TestDesc { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type, } @@ -475,7 +499,9 @@ pub fn exclude_should_panic_option() { ignore: false, should_panic: ShouldPanic::Yes, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -499,7 +525,9 @@ pub fn exact_filter_match() { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -593,7 +621,9 @@ pub fn sort_tests() { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }, @@ -672,7 +702,9 @@ pub fn test_bench_no_iter() { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }; @@ -694,7 +726,9 @@ pub fn test_bench_iter() { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }; @@ -710,7 +744,9 @@ fn should_sort_failures_before_printing_them() { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }; @@ -720,7 +756,9 @@ fn should_sort_failures_before_printing_them() { ignore: false, should_panic: ShouldPanic::No, allow_fail: false, + #[cfg(not(bootstrap))] compile_fail: false, + #[cfg(not(bootstrap))] no_run: false, test_type: TestType::Unknown, }; diff --git a/library/test/src/types.rs b/library/test/src/types.rs index a2c3d5fa8ee..4cbdc7affc6 100644 --- a/library/test/src/types.rs +++ b/library/test/src/types.rs @@ -124,7 +124,9 @@ pub struct TestDesc { pub ignore: bool, pub should_panic: options::ShouldPanic, pub allow_fail: bool, + #[cfg(not(bootstrap))] pub compile_fail: bool, + #[cfg(not(bootstrap))] pub no_run: bool, pub test_type: TestType, } @@ -143,7 +145,8 @@ impl TestDesc { } } - pub fn test_mode_string(&self) -> &'static str { + #[cfg(not(bootstrap))] + pub fn test_mode(&self) -> &'static str { if self.ignore { return &"ignore"; } @@ -164,6 +167,11 @@ impl TestDesc { } &"run" } + + #[cfg(bootstrap)] + pub fn test_mode(&self) -> &'static str { + &"" + } } #[derive(Debug)] diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 8ef9170f919..c33d0ba4e57 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -935,7 +935,9 @@ impl Tester for Collector { // compiler failures are test failures should_panic: testing::ShouldPanic::No, allow_fail: config.allow_fail, + #[cfg(not(bootstrap))] compile_fail: config.compile_fail, + #[cfg(not(bootstrap))] no_run, test_type: testing::TestType::DocTest, }, diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index f3751ff244f..0aa1f336b6d 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -649,7 +649,9 @@ fn make_test(config: &Config, testpaths: &TestPaths, inputs: &Stamp) -> Vec Date: Sun, 16 May 2021 17:27:30 +0200 Subject: remove mode for run and ignore tests --- library/test/src/formatters/pretty.rs | 7 ++++++- library/test/src/formatters/terse.rs | 7 ++++++- library/test/src/types.rs | 4 ++-- src/test/run-make-fulldeps/issue-22131/Makefile | 2 +- src/test/run-make-fulldeps/test-harness/Makefile | 2 +- src/test/rustdoc-ui/cfg-test.stdout | 4 ++-- src/test/rustdoc-ui/doc-test-doctest-feature.stdout | 2 +- src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout | 2 +- src/test/rustdoc-ui/doctest-output.stdout | 6 +++--- src/test/rustdoc-ui/failed-doctest-output.stdout | 4 ++-- src/test/rustdoc-ui/failed-doctest-should-panic.stdout | 2 +- src/test/rustdoc-ui/issue-81662-shortness.stdout | 2 +- src/test/rustdoc-ui/no-run-flag.stdout | 2 +- src/test/rustdoc-ui/run-directory.correct.stdout | 2 +- src/test/rustdoc-ui/run-directory.incorrect.stdout | 2 +- src/test/rustdoc-ui/test-no_std.stdout | 2 +- src/test/rustdoc-ui/test-type.stdout | 6 +++--- src/test/rustdoc-ui/unparseable-doc-test.stdout | 2 +- src/test/ui/test-attrs/test-filter-multiple.run.stdout | 4 ++-- src/test/ui/test-attrs/test-type.run.stdout | 4 ++-- src/test/ui/test-panic-abort-nocapture.run.stdout | 6 +++--- src/test/ui/test-panic-abort.run.stdout | 8 ++++---- src/test/ui/test-passed.run.stdout | 4 ++-- src/test/ui/test-thread-capture.run.stdout | 4 ++-- src/test/ui/test-thread-nocapture.run.stdout | 4 ++-- src/tools/compiletest/src/runtest.rs | 7 +++---- 26 files changed, 55 insertions(+), 46 deletions(-) (limited to 'library/test/src/formatters') diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs index c1a0bb9f3e1..b3efb2c4437 100644 --- a/library/test/src/formatters/pretty.rs +++ b/library/test/src/formatters/pretty.rs @@ -169,7 +169,12 @@ impl PrettyFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode()))?; + let test_mode = desc.test_mode(); + if test_mode == "" { + self.write_plain(&format!("test {} ... ", name))?; + } else { + self.write_plain(&format!("test {} - {} ... ", name, test_mode))?; + } Ok(()) } diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs index a9589829ad2..ce73f8d3bfb 100644 --- a/library/test/src/formatters/terse.rs +++ b/library/test/src/formatters/terse.rs @@ -158,7 +158,12 @@ impl TerseFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode()))?; + let test_mode = desc.test_mode(); + if test_mode == "" { + self.write_plain(&format!("test {} ... ", name))?; + } else { + self.write_plain(&format!("test {} - {} ... ", name, test_mode))?; + } Ok(()) } diff --git a/library/test/src/types.rs b/library/test/src/types.rs index 4cbdc7affc6..baf9908669b 100644 --- a/library/test/src/types.rs +++ b/library/test/src/types.rs @@ -148,7 +148,7 @@ impl TestDesc { #[cfg(not(bootstrap))] pub fn test_mode(&self) -> &'static str { if self.ignore { - return &"ignore"; + return &""; } match self.should_panic { options::ShouldPanic::Yes | options::ShouldPanic::YesWithMessage(_) => { @@ -165,7 +165,7 @@ impl TestDesc { if self.no_run { return &"compile"; } - &"run" + &"" } #[cfg(bootstrap)] diff --git a/src/test/run-make-fulldeps/issue-22131/Makefile b/src/test/run-make-fulldeps/issue-22131/Makefile index 5f721ef3130..d76aaf5c146 100644 --- a/src/test/run-make-fulldeps/issue-22131/Makefile +++ b/src/test/run-make-fulldeps/issue-22131/Makefile @@ -4,4 +4,4 @@ all: foo.rs $(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs $(RUSTDOC) --test --cfg 'feature="bar"' \ -L $(TMPDIR) foo.rs |\ - $(CGREP) 'foo.rs - foo (line 1) - run ... ok' + $(CGREP) 'foo.rs - foo (line 1) ... ok' diff --git a/src/test/run-make-fulldeps/test-harness/Makefile b/src/test/run-make-fulldeps/test-harness/Makefile index 1f3b112d6af..39477c07ced 100644 --- a/src/test/run-make-fulldeps/test-harness/Makefile +++ b/src/test/run-make-fulldeps/test-harness/Makefile @@ -3,6 +3,6 @@ all: # check that #[cfg_attr(..., ignore)] does the right thing. $(RUSTC) --test test-ignore-cfg.rs --cfg ignorecfg - $(call RUN,test-ignore-cfg) | $(CGREP) 'shouldnotignore - run ... ok' 'shouldignore - ignore ... ignored' + $(call RUN,test-ignore-cfg) | $(CGREP) 'shouldnotignore ... ok' 'shouldignore ... ignored' $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -e "^i\.$$" $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -v 'should' diff --git a/src/test/rustdoc-ui/cfg-test.stdout b/src/test/rustdoc-ui/cfg-test.stdout index 42d3fbb48dd..2960ff8d3b4 100644 --- a/src/test/rustdoc-ui/cfg-test.stdout +++ b/src/test/rustdoc-ui/cfg-test.stdout @@ -1,7 +1,7 @@ running 2 tests -test $DIR/cfg-test.rs - Bar (line 27) - run ... ok -test $DIR/cfg-test.rs - Foo (line 19) - run ... ok +test $DIR/cfg-test.rs - Bar (line 27) ... ok +test $DIR/cfg-test.rs - Foo (line 19) ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/doc-test-doctest-feature.stdout b/src/test/rustdoc-ui/doc-test-doctest-feature.stdout index cfcb60332f4..d7de1f10522 100644 --- a/src/test/rustdoc-ui/doc-test-doctest-feature.stdout +++ b/src/test/rustdoc-ui/doc-test-doctest-feature.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/doc-test-doctest-feature.rs - Foo (line 9) - run ... ok +test $DIR/doc-test-doctest-feature.rs - Foo (line 9) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout index 8d7f1ad21d1..5b07fc4c87a 100644 --- a/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout +++ b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) - run ... ok +test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/doctest-output.stdout b/src/test/rustdoc-ui/doctest-output.stdout index 7a07d273e26..35b0e366fb5 100644 --- a/src/test/rustdoc-ui/doctest-output.stdout +++ b/src/test/rustdoc-ui/doctest-output.stdout @@ -1,8 +1,8 @@ running 3 tests -test $DIR/doctest-output.rs - (line 8) - run ... ok -test $DIR/doctest-output.rs - ExpandedStruct (line 24) - run ... ok -test $DIR/doctest-output.rs - foo::bar (line 18) - run ... ok +test $DIR/doctest-output.rs - (line 8) ... ok +test $DIR/doctest-output.rs - ExpandedStruct (line 24) ... ok +test $DIR/doctest-output.rs - foo::bar (line 18) ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout index 7ba599ff11b..6dfe648f854 100644 --- a/src/test/rustdoc-ui/failed-doctest-output.stdout +++ b/src/test/rustdoc-ui/failed-doctest-output.stdout @@ -1,7 +1,7 @@ running 2 tests -test $DIR/failed-doctest-output.rs - OtherStruct (line 22) - run ... FAILED -test $DIR/failed-doctest-output.rs - SomeStruct (line 12) - run ... FAILED +test $DIR/failed-doctest-output.rs - OtherStruct (line 22) ... FAILED +test $DIR/failed-doctest-output.rs - SomeStruct (line 12) ... FAILED failures: diff --git a/src/test/rustdoc-ui/failed-doctest-should-panic.stdout b/src/test/rustdoc-ui/failed-doctest-should-panic.stdout index 6bd21423e69..57a20092a5d 100644 --- a/src/test/rustdoc-ui/failed-doctest-should-panic.stdout +++ b/src/test/rustdoc-ui/failed-doctest-should-panic.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/failed-doctest-should-panic.rs - Foo (line 9) - run ... FAILED +test $DIR/failed-doctest-should-panic.rs - Foo (line 9) ... FAILED failures: diff --git a/src/test/rustdoc-ui/issue-81662-shortness.stdout b/src/test/rustdoc-ui/issue-81662-shortness.stdout index f9fdf7048d8..748113be3a2 100644 --- a/src/test/rustdoc-ui/issue-81662-shortness.stdout +++ b/src/test/rustdoc-ui/issue-81662-shortness.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/issue-81662-shortness.rs - foo (line 6) - run ... FAILED +test $DIR/issue-81662-shortness.rs - foo (line 6) ... FAILED failures: diff --git a/src/test/rustdoc-ui/no-run-flag.stdout b/src/test/rustdoc-ui/no-run-flag.stdout index 22d927317b3..02f28aaf60d 100644 --- a/src/test/rustdoc-ui/no-run-flag.stdout +++ b/src/test/rustdoc-ui/no-run-flag.stdout @@ -1,7 +1,7 @@ running 7 tests test $DIR/no-run-flag.rs - f (line 11) - compile ... ok -test $DIR/no-run-flag.rs - f (line 14) - ignore ... ignored +test $DIR/no-run-flag.rs - f (line 14) ... ignored test $DIR/no-run-flag.rs - f (line 17) - compile ... ok test $DIR/no-run-flag.rs - f (line 23) - compile fail ... ok test $DIR/no-run-flag.rs - f (line 28) - compile ... ok diff --git a/src/test/rustdoc-ui/run-directory.correct.stdout b/src/test/rustdoc-ui/run-directory.correct.stdout index 1bb84a868a4..e9b2754794a 100644 --- a/src/test/rustdoc-ui/run-directory.correct.stdout +++ b/src/test/rustdoc-ui/run-directory.correct.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/run-directory.rs - foo (line 10) - run ... ok +test $DIR/run-directory.rs - foo (line 10) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/run-directory.incorrect.stdout b/src/test/rustdoc-ui/run-directory.incorrect.stdout index 7f6bba8fe47..97a5dbc5c0c 100644 --- a/src/test/rustdoc-ui/run-directory.incorrect.stdout +++ b/src/test/rustdoc-ui/run-directory.incorrect.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/run-directory.rs - foo (line 19) - run ... ok +test $DIR/run-directory.rs - foo (line 19) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/test-no_std.stdout b/src/test/rustdoc-ui/test-no_std.stdout index 35d44fa6bbd..8d5a30804c1 100644 --- a/src/test/rustdoc-ui/test-no_std.stdout +++ b/src/test/rustdoc-ui/test-no_std.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/test-no_std.rs - f (line 10) - run ... ok +test $DIR/test-no_std.rs - f (line 10) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/test-type.stdout b/src/test/rustdoc-ui/test-type.stdout index fb6c036a608..a66fd240d34 100644 --- a/src/test/rustdoc-ui/test-type.stdout +++ b/src/test/rustdoc-ui/test-type.stdout @@ -1,10 +1,10 @@ running 5 tests -test $DIR/test-type.rs - f (line 12) - ignore ... ignored +test $DIR/test-type.rs - f (line 12) ... ignored test $DIR/test-type.rs - f (line 15) - compile ... ok test $DIR/test-type.rs - f (line 21) - compile fail ... ok -test $DIR/test-type.rs - f (line 6) - run ... ok -test $DIR/test-type.rs - f (line 9) - run ... ok +test $DIR/test-type.rs - f (line 6) ... ok +test $DIR/test-type.rs - f (line 9) ... ok test result: ok. 4 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/rustdoc-ui/unparseable-doc-test.stdout b/src/test/rustdoc-ui/unparseable-doc-test.stdout index 13526acfc47..2641c66f25e 100644 --- a/src/test/rustdoc-ui/unparseable-doc-test.stdout +++ b/src/test/rustdoc-ui/unparseable-doc-test.stdout @@ -1,6 +1,6 @@ running 1 test -test $DIR/unparseable-doc-test.rs - foo (line 7) - run ... FAILED +test $DIR/unparseable-doc-test.rs - foo (line 7) ... FAILED failures: diff --git a/src/test/ui/test-attrs/test-filter-multiple.run.stdout b/src/test/ui/test-attrs/test-filter-multiple.run.stdout index 5d6d5cbd3c3..1aa684ed507 100644 --- a/src/test/ui/test-attrs/test-filter-multiple.run.stdout +++ b/src/test/ui/test-attrs/test-filter-multiple.run.stdout @@ -1,7 +1,7 @@ running 2 tests -test test1 - run ... ok -test test2 - run ... ok +test test1 ... ok +test test2 ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in $TIME diff --git a/src/test/ui/test-attrs/test-type.run.stdout b/src/test/ui/test-attrs/test-type.run.stdout index 9f789526615..be2fd8ae68c 100644 --- a/src/test/ui/test-attrs/test-type.run.stdout +++ b/src/test/ui/test-attrs/test-type.run.stdout @@ -1,7 +1,7 @@ running 3 tests -test test_no_run - ignore ... ignored -test test_ok - run ... ok +test test_no_run ... ignored +test test_ok ... ok test test_panic - should panic ... ok test result: ok. 2 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/ui/test-panic-abort-nocapture.run.stdout b/src/test/ui/test-panic-abort-nocapture.run.stdout index e335cf05153..8a91732a754 100644 --- a/src/test/ui/test-panic-abort-nocapture.run.stdout +++ b/src/test/ui/test-panic-abort-nocapture.run.stdout @@ -1,12 +1,12 @@ running 4 tests -test it_fails - run ... about to fail +test it_fails ... about to fail FAILED test it_panics - should panic ... about to panic ok -test it_works - run ... about to succeed +test it_works ... about to succeed ok -test it_writes_to_stdio - run ... hello, world +test it_writes_to_stdio ... hello, world testing123 ok diff --git a/src/test/ui/test-panic-abort.run.stdout b/src/test/ui/test-panic-abort.run.stdout index 0d9de10c981..f608a8cdc55 100644 --- a/src/test/ui/test-panic-abort.run.stdout +++ b/src/test/ui/test-panic-abort.run.stdout @@ -1,10 +1,10 @@ running 5 tests -test it_exits - run ... FAILED -test it_fails - run ... FAILED +test it_exits ... FAILED +test it_fails ... FAILED test it_panics - should panic ... ok -test it_works - run ... ok -test no_residual_environment - run ... ok +test it_works ... ok +test no_residual_environment ... ok failures: diff --git a/src/test/ui/test-passed.run.stdout b/src/test/ui/test-passed.run.stdout index 995643a62c8..17f70d60749 100644 --- a/src/test/ui/test-passed.run.stdout +++ b/src/test/ui/test-passed.run.stdout @@ -1,7 +1,7 @@ running 2 tests -test it_works - run ... ok -test it_works_too - run ... ok +test it_works ... ok +test it_works_too ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/src/test/ui/test-thread-capture.run.stdout b/src/test/ui/test-thread-capture.run.stdout index ce9ec63b526..487cfb55eb4 100644 --- a/src/test/ui/test-thread-capture.run.stdout +++ b/src/test/ui/test-thread-capture.run.stdout @@ -1,7 +1,7 @@ running 2 tests -test thready_fail - run ... FAILED -test thready_pass - run ... ok +test thready_fail ... FAILED +test thready_pass ... ok failures: diff --git a/src/test/ui/test-thread-nocapture.run.stdout b/src/test/ui/test-thread-nocapture.run.stdout index bd1971ab7d3..9d2da50826c 100644 --- a/src/test/ui/test-thread-nocapture.run.stdout +++ b/src/test/ui/test-thread-nocapture.run.stdout @@ -1,11 +1,11 @@ running 2 tests -test thready_fail - run ... fee +test thready_fail ... fee fie foe fum FAILED -test thready_pass - run ... fee +test thready_pass ... fee fie foe fum diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 0898e9ef2f6..18c40a037c5 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2637,12 +2637,11 @@ impl<'test> TestCx<'test> { let mut tested = 0; for _ in res.stdout.split('\n').filter(|s| s.starts_with("test ")).inspect(|s| { - let tmp: Vec<&str> = s.split(" - ").collect(); - if tmp.len() == 3 { - let path = tmp[0].rsplit("test ").next().unwrap(); + if let Some((left, right)) = s.split_once(" - ") { + let path = left.rsplit("test ").next().unwrap(); if let Some(ref mut v) = files.get_mut(&path.replace('\\', "/")) { tested += 1; - let mut iter = tmp[1].split("(line "); + let mut iter = right.split("(line "); iter.next(); let line = iter .next() -- cgit 1.4.1-3-g733a5 From 6de13c3ffc969ceac87f2a8466c5cd850288721c Mon Sep 17 00:00:00 2001 From: Aliénore Bouttefeux Date: Tue, 18 May 2021 18:17:36 +0200 Subject: change based on review --- library/test/src/formatters/pretty.rs | 7 +++---- library/test/src/formatters/terse.rs | 7 +++---- library/test/src/types.rs | 20 +++++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'library/test/src/formatters') diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs index b3efb2c4437..e17fc08a9ae 100644 --- a/library/test/src/formatters/pretty.rs +++ b/library/test/src/formatters/pretty.rs @@ -169,11 +169,10 @@ impl PrettyFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - let test_mode = desc.test_mode(); - if test_mode == "" { - self.write_plain(&format!("test {} ... ", name))?; - } else { + if let Some(test_mode) = desc.test_mode() { self.write_plain(&format!("test {} - {} ... ", name, test_mode))?; + } else { + self.write_plain(&format!("test {} ... ", name))?; } Ok(()) diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs index ce73f8d3bfb..a2c223c494c 100644 --- a/library/test/src/formatters/terse.rs +++ b/library/test/src/formatters/terse.rs @@ -158,11 +158,10 @@ impl TerseFormatter { fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { let name = desc.padded_name(self.max_name_len, desc.name.padding()); - let test_mode = desc.test_mode(); - if test_mode == "" { - self.write_plain(&format!("test {} ... ", name))?; - } else { + if let Some(test_mode) = desc.test_mode() { self.write_plain(&format!("test {} - {} ... ", name, test_mode))?; + } else { + self.write_plain(&format!("test {} ... ", name))?; } Ok(()) diff --git a/library/test/src/types.rs b/library/test/src/types.rs index baf9908669b..63907c71ea7 100644 --- a/library/test/src/types.rs +++ b/library/test/src/types.rs @@ -145,32 +145,34 @@ impl TestDesc { } } + /// Returns None for ignored test or that that are just run, otherwise give a description of the type of test. + /// Descriptions include "should panic", "compile fail" and "compile". #[cfg(not(bootstrap))] - pub fn test_mode(&self) -> &'static str { + pub fn test_mode(&self) -> Option<&'static str> { if self.ignore { - return &""; + return None; } match self.should_panic { options::ShouldPanic::Yes | options::ShouldPanic::YesWithMessage(_) => { - return &"should panic"; + return Some("should panic"); } options::ShouldPanic::No => {} } if self.allow_fail { - return &"allow fail"; + return Some("allow fail"); } if self.compile_fail { - return &"compile fail"; + return Some("compile fail"); } if self.no_run { - return &"compile"; + return Some("compile"); } - &"" + None } #[cfg(bootstrap)] - pub fn test_mode(&self) -> &'static str { - &"" + pub fn test_mode(&self) -> Option<&'static str> { + None } } -- cgit 1.4.1-3-g733a5