Always show test traces (unless manually turned off with flag)

On both failures and success.
This commit is contained in:
KtorZ 2024-03-10 18:53:11 +01:00
parent c169596c76
commit be7d07fa99
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 18 additions and 4 deletions

View File

@ -329,15 +329,29 @@ fn fmt_test(
..
}) if !result.is_success() => {
test = format!(
"{test}\n{}{new_line}",
"{test}\n{}",
assertion.to_string(Stderr, unit_test.can_error),
new_line = if result.logs().is_empty() { "\n" } else { "" },
);
}
_ => (),
}
// CounterExample
// CounterExamples
if let TestResult::PropertyTestResult(PropertyTestResult {
counterexample: None,
..
}) = result
{
if !result.is_success() {
test = format!(
"{test}\n{}",
"× no counterexample found"
.if_supports_color(Stderr, |s| s.red())
.if_supports_color(Stderr, |s| s.bold())
);
}
}
if let TestResult::PropertyTestResult(PropertyTestResult {
counterexample: Some(counterexample),
..
@ -409,7 +423,7 @@ fn fmt_test(
}
// Traces
if !result.logs().is_empty() && result.is_success() {
if !result.logs().is_empty() {
test = format!(
"{test}\n{title}\n{logs}",
title = "· with traces".if_supports_color(Stderr, |s| s.bold()),