diff --git a/formatters/terse.rs b/formatters/terse.rs index 22a06b9..6f7dfee 100644 --- a/formatters/terse.rs +++ b/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 @@ impl TerseFormatter { max_name_len, is_multithreaded, test_count: 0, + total_test_count: 0, // initialized later, when write_run_start is called } } @@ -66,7 +68,8 @@ impl TerseFormatter { // 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 @@ impl TerseFormatter { 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)) }