diff options
| author | bors <bors@rust-lang.org> | 2021-06-06 09:13:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-06-06 09:13:59 +0000 |
| commit | 3740ba2a7dd965ca45db500ebf7ad580a7812c07 (patch) | |
| tree | 03e3f6532aa38d33f9ce21646c4316593f213a10 /library/test/src/formatters | |
| parent | 9a576175cc9a0aecb85d0764a4f66ee29e26e155 (diff) | |
| parent | 6de13c3ffc969ceac87f2a8466c5cd850288721c (diff) | |
Auto merge of #84863 - ABouttefeux:libtest, r=m-ou-se
Show test type during prints Test output can sometimes be confusing. For example doctest with the no_run argument are displayed the same way than test that are run. During #83857 I got the feedback that test output can be confusing. For the moment test output is ``` test $DIR/test-type.rs - f (line 12) ... ignored test $DIR/test-type.rs - f (line 15) ... ok test $DIR/test-type.rs - f (line 21) ... ok test $DIR/test-type.rs - f (line 6) ... ok ``` I propose to change output by indicating the test type as ``` 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) ... ok ``` by indicating the test type after the test name (and in the case of doctest after the function name and line) and before the "...". ------------ Note: this is a proof of concept, the implementation is probably not optimal as the properties added in `TestDesc` are only use in the display and does not represent actual change of behavior, maybe `TestType::DocTest` could have fields
Diffstat (limited to 'library/test/src/formatters')
| -rw-r--r-- | library/test/src/formatters/pretty.rs | 6 | ||||
| -rw-r--r-- | library/test/src/formatters/terse.rs | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs index 5e41d6d9692..e17fc08a9ae 100644 --- a/library/test/src/formatters/pretty.rs +++ b/library/test/src/formatters/pretty.rs @@ -169,7 +169,11 @@ impl<T: Write> PrettyFormatter<T> { 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))?; + 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 6f46f7255a4..a2c223c494c 100644 --- a/library/test/src/formatters/terse.rs +++ b/library/test/src/formatters/terse.rs @@ -158,7 +158,11 @@ impl<T: Write> TerseFormatter<T> { 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))?; + if let Some(test_mode) = desc.test_mode() { + self.write_plain(&format!("test {} - {} ... ", name, test_mode))?; + } else { + self.write_plain(&format!("test {} ... ", name))?; + } Ok(()) } |
