From d4069148c7fe9f971ebb9a96c11ae1c99e1eab76 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Sun, 10 Mar 2024 18:59:11 +0100 Subject: [PATCH] Remove UnitTestResult's output field Dead-code. Also renamed 'logs' to 'traces'. --- crates/aiken-project/src/telemetry.rs | 8 ++++---- crates/aiken-project/src/test_framework.rs | 13 +++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/crates/aiken-project/src/telemetry.rs b/crates/aiken-project/src/telemetry.rs index 963588ca..bb681f9e 100644 --- a/crates/aiken-project/src/telemetry.rs +++ b/crates/aiken-project/src/telemetry.rs @@ -423,12 +423,12 @@ fn fmt_test( } // Traces - if !result.logs().is_empty() { + if !result.traces().is_empty() { test = format!( - "{test}\n{title}\n{logs}", + "{test}\n{title}\n{traces}", title = "ยท with traces".if_supports_color(Stderr, |s| s.bold()), - logs = result - .logs() + traces = result + .traces() .iter() .map(|line| { format!("| {line}",) }) .collect::>() diff --git a/crates/aiken-project/src/test_framework.rs b/crates/aiken-project/src/test_framework.rs index c319e952..04ac8dbe 100644 --- a/crates/aiken-project/src/test_framework.rs +++ b/crates/aiken-project/src/test_framework.rs @@ -180,8 +180,7 @@ impl UnitTest { success, test: self.to_owned(), spent_budget: eval_result.cost(), - logs: eval_result.logs(), - output: eval_result.result().ok(), + traces: eval_result.logs(), assertion: self.assertion, }) } @@ -829,9 +828,9 @@ impl TestResult { } } - pub fn logs(&self) -> &[String] { + pub fn traces(&self) -> &[String] { match self { - TestResult::UnitTestResult(UnitTestResult { ref logs, .. }) => logs.as_slice(), + TestResult::UnitTestResult(UnitTestResult { ref traces, .. }) => traces.as_slice(), TestResult::PropertyTestResult(..) => &[], } } @@ -862,8 +861,7 @@ impl TestResult { pub struct UnitTestResult { pub success: bool, pub spent_budget: ExBudget, - pub output: Option>, - pub logs: Vec, + pub traces: Vec, pub test: UnitTest, pub assertion: Option>, } @@ -878,8 +876,7 @@ impl UnitTestResult<(Constant, Rc)> { UnitTestResult { success: self.success, spent_budget: self.spent_budget, - output: self.output, - logs: self.logs, + traces: self.traces, test: self.test, assertion: self.assertion.and_then(|assertion| { // No need to spend time/cpu on reifying assertions for successful