Skip to content

Commit b72a7fb

Browse files
committed
Improve terse test output.
The current terse output gives 112 chars per line, which causes wraparound for people using 100 char wide terminals, which is very common. This commit changes it to be exactly 100 wide, which makes the output look much nicer.
1 parent 6a9080b commit b72a7fb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

library/test/src/formatters/terse.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ use crate::{
1111
types::TestDesc,
1212
};
1313

14-
// insert a '\n' after 100 tests in quiet mode
15-
const QUIET_MODE_MAX_COLUMN: usize = 100;
14+
// We insert a '\n' when the output hits 100 columns in quiet mode. 88 test
15+
// result chars leaves 12 chars for a progress count like " 11704/12853".
16+
const QUIET_MODE_MAX_COLUMN: usize = 88;
1617

1718
pub(crate) struct TerseFormatter<T> {
1819
out: OutputLocation<T>,
@@ -65,7 +66,7 @@ impl<T: Write> TerseFormatter<T> {
6566
) -> io::Result<()> {
6667
self.write_pretty(result, color)?;
6768
if self.test_count % QUIET_MODE_MAX_COLUMN == QUIET_MODE_MAX_COLUMN - 1 {
68-
// we insert a new line every 100 dots in order to flush the
69+
// We insert a new line regularly in order to flush the
6970
// screen when dealing with line-buffered output (e.g., piping to
7071
// `stamp` in the rust CI).
7172
let out = format!(" {}/{}\n", self.test_count + 1, self.total_test_count);

0 commit comments

Comments
 (0)