Skip to content

Commit

Permalink
Rollup merge of #95709 - nnethercote:improve-terse-test-output, r=Dyl…
Browse files Browse the repository at this point in the history
…an-DPC

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.
  • Loading branch information
Dylan-DPC authored Apr 6, 2022
2 parents 64e7bf9 + b72a7fb commit 687e40a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions library/test/src/formatters/terse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ use crate::{
types::TestDesc,
};

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

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

0 comments on commit 687e40a

Please sign in to comment.