Add an optional check count; when we run a command that runs tests, we can set this to Some(x) and it'll print in the summary
This commit is contained in:
parent
49ca7e1f75
commit
e944f10372
|
@ -24,6 +24,7 @@ impl ExitFailure {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Summary {
|
struct Summary {
|
||||||
|
check_count: Option<usize>,
|
||||||
warning_count: usize,
|
warning_count: usize,
|
||||||
error_count: usize,
|
error_count: usize,
|
||||||
}
|
}
|
||||||
|
@ -31,10 +32,18 @@ struct Summary {
|
||||||
impl Display for Summary {
|
impl Display for Summary {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
f.write_str(&format!(
|
f.write_str(&format!(
|
||||||
" {} {} {}, {} {}",
|
" {} {}{}{} {}, {} {}",
|
||||||
"Summary"
|
"Summary"
|
||||||
.if_supports_color(Stderr, |s| s.purple())
|
.if_supports_color(Stderr, |s| s.purple())
|
||||||
.if_supports_color(Stderr, |s| s.bold()),
|
.if_supports_color(Stderr, |s| s.bold()),
|
||||||
|
if let Some(c) = self.check_count { format!("{} ", c) } else { "".to_string() },
|
||||||
|
match self.check_count {
|
||||||
|
Some(1) => "check, ",
|
||||||
|
Some(_) => "checks, ",
|
||||||
|
None => ""
|
||||||
|
}
|
||||||
|
.if_supports_color(Stderr, |s| s.green())
|
||||||
|
.if_supports_color(Stderr, |s| s.bold()),
|
||||||
self.error_count,
|
self.error_count,
|
||||||
if self.error_count == 1 {
|
if self.error_count == 1 {
|
||||||
"error"
|
"error"
|
||||||
|
@ -111,6 +120,7 @@ where
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"{}",
|
"{}",
|
||||||
Summary {
|
Summary {
|
||||||
|
check_count: None,
|
||||||
warning_count,
|
warning_count,
|
||||||
error_count: errs.len(),
|
error_count: errs.len(),
|
||||||
}
|
}
|
||||||
|
@ -122,6 +132,7 @@ where
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"{}",
|
"{}",
|
||||||
Summary {
|
Summary {
|
||||||
|
check_count: Some(41),
|
||||||
error_count: 0,
|
error_count: 0,
|
||||||
warning_count
|
warning_count
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue