diff --git a/src/libtest/formatters/terse.rs b/src/libtest/formatters/terse.rs index 22a06b9f605..5b6b8ead4ef 100644 --- a/src/libtest/formatters/terse.rs +++ b/src/libtest/formatters/terse.rs @@ -18,6 +18,7 @@ pub(crate) struct TerseFormatter { max_name_len: usize, test_count: usize, + total_test_count: usize, } impl TerseFormatter { @@ -33,6 +34,7 @@ pub fn new( max_name_len, is_multithreaded, test_count: 0, + total_test_count: 0, } } @@ -66,7 +68,8 @@ pub fn write_short_result( // 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; @@ -160,6 +163,7 @@ fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> { impl OutputFormatter for TerseFormatter { 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)) }