From 181d28bb6110dc974879db20d433f21aa142db3a Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Tue, 5 Apr 2022 22:42:23 +0200 Subject: trivial cfg(bootstrap) changes --- library/test/src/console.rs | 10 +--------- library/test/src/formatters/json.rs | 26 ++++++++++---------------- library/test/src/formatters/pretty.rs | 7 +------ library/test/src/tests.rs | 19 ------------------- library/test/src/types.rs | 1 - 5 files changed, 12 insertions(+), 51 deletions(-) (limited to 'library/test/src') diff --git a/library/test/src/console.rs b/library/test/src/console.rs index 56eef8314fb..dc0123cf432 100644 --- a/library/test/src/console.rs +++ b/library/test/src/console.rs @@ -103,12 +103,7 @@ impl ConsoleTestState { exec_time: Option<&TestExecTime>, ) -> io::Result<()> { self.write_log(|| { - let TestDesc { - name, - #[cfg(not(bootstrap))] - ignore_message, - .. - } = test; + let TestDesc { name, ignore_message, .. } = test; format!( "{} {}", match *result { @@ -116,14 +111,11 @@ impl ConsoleTestState { TestResult::TrFailed => "failed".to_owned(), TestResult::TrFailedMsg(ref msg) => format!("failed: {msg}"), TestResult::TrIgnored => { - #[cfg(not(bootstrap))] if let Some(msg) = ignore_message { format!("ignored: {msg}") } else { "ignored".to_owned() } - #[cfg(bootstrap)] - "ignored".to_owned() } TestResult::TrBench(ref bs) => fmt_bench_samples(bs), TestResult::TrTimedFail => "failed (time limit exceeded)".to_owned(), diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs index 737921c1e10..c07fdafb167 100644 --- a/library/test/src/formatters/json.rs +++ b/library/test/src/formatters/json.rs @@ -120,22 +120,16 @@ impl OutputFormatter for JsonFormatter { Some(&*format!(r#""message": "{}""#, EscapedString(m))), ), - TestResult::TrIgnored => { - #[cfg(not(bootstrap))] - return self.write_event( - "test", - desc.name.as_slice(), - "ignored", - exec_time, - stdout, - desc.ignore_message - .map(|msg| format!(r#""message": "{}""#, EscapedString(msg))) - .as_deref(), - ); - - #[cfg(bootstrap)] - self.write_event("test", desc.name.as_slice(), "ignored", exec_time, stdout, None) - } + TestResult::TrIgnored => self.write_event( + "test", + desc.name.as_slice(), + "ignored", + exec_time, + stdout, + desc.ignore_message + .map(|msg| format!(r#""message": "{}""#, EscapedString(msg))) + .as_deref(), + ), TestResult::TrBench(ref bs) => { let median = bs.ns_iter_summ.median as usize; diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs index 9b407df2190..69420222980 100644 --- a/library/test/src/formatters/pretty.rs +++ b/library/test/src/formatters/pretty.rs @@ -218,12 +218,7 @@ impl OutputFormatter for PrettyFormatter { match *result { TestResult::TrOk => self.write_ok()?, TestResult::TrFailed | TestResult::TrFailedMsg(_) => self.write_failed()?, - TestResult::TrIgnored => { - #[cfg(not(bootstrap))] - self.write_ignored(desc.ignore_message)?; - #[cfg(bootstrap)] - self.write_ignored(None)?; - } + TestResult::TrIgnored => self.write_ignored(desc.ignore_message)?, TestResult::TrBench(ref bs) => { self.write_bench()?; self.write_plain(&format!(": {}", fmt_bench_samples(bs)))?; diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs index 8329e9735d4..0b81aff5907 100644 --- a/library/test/src/tests.rs +++ b/library/test/src/tests.rs @@ -61,7 +61,6 @@ fn one_ignored_one_unignored_test() -> Vec { desc: TestDesc { name: StaticTestName("1"), ignore: true, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -74,7 +73,6 @@ fn one_ignored_one_unignored_test() -> Vec { desc: TestDesc { name: StaticTestName("2"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -95,7 +93,6 @@ pub fn do_not_run_ignored_tests() { desc: TestDesc { name: StaticTestName("whatever"), ignore: true, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -117,7 +114,6 @@ pub fn ignored_tests_result_in_ignored() { desc: TestDesc { name: StaticTestName("whatever"), ignore: true, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -143,7 +139,6 @@ fn test_should_panic() { desc: TestDesc { name: StaticTestName("whatever"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::Yes, compile_fail: false, @@ -169,7 +164,6 @@ fn test_should_panic_good_message() { desc: TestDesc { name: StaticTestName("whatever"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::YesWithMessage("error message"), compile_fail: false, @@ -200,7 +194,6 @@ fn test_should_panic_bad_message() { desc: TestDesc { name: StaticTestName("whatever"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::YesWithMessage(expected), compile_fail: false, @@ -235,7 +228,6 @@ fn test_should_panic_non_string_message_type() { desc: TestDesc { name: StaticTestName("whatever"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::YesWithMessage(expected), compile_fail: false, @@ -262,7 +254,6 @@ fn test_should_panic_but_succeeds() { desc: TestDesc { name: StaticTestName("whatever"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic, compile_fail: false, @@ -297,7 +288,6 @@ fn report_time_test_template(report_time: bool) -> Option { desc: TestDesc { name: StaticTestName("whatever"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -333,7 +323,6 @@ fn time_test_failure_template(test_type: TestType) -> TestResult { desc: TestDesc { name: StaticTestName("whatever"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -373,7 +362,6 @@ fn typed_test_desc(test_type: TestType) -> TestDesc { TestDesc { name: StaticTestName("whatever"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -486,7 +474,6 @@ pub fn exclude_should_panic_option() { desc: TestDesc { name: StaticTestName("3"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::Yes, compile_fail: false, @@ -511,7 +498,6 @@ pub fn exact_filter_match() { desc: TestDesc { name: StaticTestName(name), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -601,7 +587,6 @@ fn sample_tests() -> Vec { desc: TestDesc { name: DynTestName((*name).clone()), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -753,7 +738,6 @@ pub fn test_bench_no_iter() { let desc = TestDesc { name: StaticTestName("f"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -776,7 +760,6 @@ pub fn test_bench_iter() { let desc = TestDesc { name: StaticTestName("f"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -793,7 +776,6 @@ fn should_sort_failures_before_printing_them() { let test_a = TestDesc { name: StaticTestName("a"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, @@ -804,7 +786,6 @@ fn should_sort_failures_before_printing_them() { let test_b = TestDesc { name: StaticTestName("b"), ignore: false, - #[cfg(not(bootstrap))] ignore_message: None, should_panic: ShouldPanic::No, compile_fail: false, diff --git a/library/test/src/types.rs b/library/test/src/types.rs index 1084fb98389..ffb1efe18cc 100644 --- a/library/test/src/types.rs +++ b/library/test/src/types.rs @@ -117,7 +117,6 @@ pub struct TestId(pub usize); pub struct TestDesc { pub name: TestName, pub ignore: bool, - #[cfg(not(bootstrap))] pub ignore_message: Option<&'static str>, pub should_panic: options::ShouldPanic, pub compile_fail: bool, -- cgit 1.4.1-3-g733a5