From be7d07fa999fbd8b49d4969cf153b043f632524a Mon Sep 17 00:00:00 2001 From: KtorZ Date: Sun, 10 Mar 2024 18:53:11 +0100 Subject: [PATCH] Always show test traces (unless manually turned off with flag) On both failures and success. --- crates/aiken-project/src/telemetry.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/crates/aiken-project/src/telemetry.rs b/crates/aiken-project/src/telemetry.rs index 958b2d03..963588ca 100644 --- a/crates/aiken-project/src/telemetry.rs +++ b/crates/aiken-project/src/telemetry.rs @@ -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()),