Skip to content

Commit 67b7b2a

Browse files
committed
libtest terse format: show how far in we are
1 parent 142bb27 commit 67b7b2a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/libtest/formatters/terse.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub(crate) struct TerseFormatter<T> {
1818
max_name_len: usize,
1919

2020
test_count: usize,
21+
total_test_count: usize,
2122
}
2223

2324
impl<T: Write> TerseFormatter<T> {
@@ -33,6 +34,7 @@ impl<T: Write> TerseFormatter<T> {
3334
max_name_len,
3435
is_multithreaded,
3536
test_count: 0,
37+
total_test_count: 0,
3638
}
3739
}
3840

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

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

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

0 commit comments

Comments
 (0)