libtest terse format: show how far in we are
This commit is contained in:
parent
142bb27373
commit
67b7b2aa11
@ -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> {
|
||||
@ -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<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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user