Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/libtest/formatters/terse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub(crate) struct TerseFormatter<T> {
max_name_len: usize,

test_count: usize,
total_test_count: usize,
}

impl<T: Write> TerseFormatter<T> {
Expand All @@ -33,6 +34,7 @@ impl<T: Write> TerseFormatter<T> {
max_name_len,
is_multithreaded,
test_count: 0,
total_test_count: 0, // initialized later, when write_run_start is called
}
}

Expand Down Expand Up @@ -66,7 +68,8 @@ impl<T: Write> TerseFormatter<T> {
// we insert a new line every 100 dots in order to flush the
// screen when dealing with line-buffered output (e.g. piping to
// `stamp` in the rust CI).
self.write_plain("\n")?;
let out = format!(" {}/{}\n", self.test_count+1, self.total_test_count);
self.write_plain(&out)?;
}

self.test_count += 1;
Expand Down Expand Up @@ -160,6 +163,7 @@ impl<T: Write> TerseFormatter<T> {

impl<T: Write> OutputFormatter for TerseFormatter<T> {
fn write_run_start(&mut self, test_count: usize) -> io::Result<()> {
self.total_test_count = test_count;
let noun = if test_count != 1 { "tests" } else { "test" };
self.write_plain(&format!("\nrunning {} {}\n", test_count, noun))
}
Expand Down