Remove UnitTestResult's output field

Dead-code. Also renamed 'logs' to 'traces'.
This commit is contained in:
KtorZ 2024-03-10 18:59:11 +01:00
parent be7d07fa99
commit d4069148c7
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
2 changed files with 9 additions and 12 deletions

View File

@ -423,12 +423,12 @@ fn fmt_test(
} }
// Traces // Traces
if !result.logs().is_empty() { if !result.traces().is_empty() {
test = format!( test = format!(
"{test}\n{title}\n{logs}", "{test}\n{title}\n{traces}",
title = "· with traces".if_supports_color(Stderr, |s| s.bold()), title = "· with traces".if_supports_color(Stderr, |s| s.bold()),
logs = result traces = result
.logs() .traces()
.iter() .iter()
.map(|line| { format!("| {line}",) }) .map(|line| { format!("| {line}",) })
.collect::<Vec<_>>() .collect::<Vec<_>>()

View File

@ -180,8 +180,7 @@ impl UnitTest {
success, success,
test: self.to_owned(), test: self.to_owned(),
spent_budget: eval_result.cost(), spent_budget: eval_result.cost(),
logs: eval_result.logs(), traces: eval_result.logs(),
output: eval_result.result().ok(),
assertion: self.assertion, assertion: self.assertion,
}) })
} }
@ -829,9 +828,9 @@ impl<U, T> TestResult<U, T> {
} }
} }
pub fn logs(&self) -> &[String] { pub fn traces(&self) -> &[String] {
match self { match self {
TestResult::UnitTestResult(UnitTestResult { ref logs, .. }) => logs.as_slice(), TestResult::UnitTestResult(UnitTestResult { ref traces, .. }) => traces.as_slice(),
TestResult::PropertyTestResult(..) => &[], TestResult::PropertyTestResult(..) => &[],
} }
} }
@ -862,8 +861,7 @@ impl<U, T> TestResult<U, T> {
pub struct UnitTestResult<T> { pub struct UnitTestResult<T> {
pub success: bool, pub success: bool,
pub spent_budget: ExBudget, pub spent_budget: ExBudget,
pub output: Option<Term<NamedDeBruijn>>, pub traces: Vec<String>,
pub logs: Vec<String>,
pub test: UnitTest, pub test: UnitTest,
pub assertion: Option<Assertion<T>>, pub assertion: Option<Assertion<T>>,
} }
@ -878,8 +876,7 @@ impl UnitTestResult<(Constant, Rc<Type>)> {
UnitTestResult { UnitTestResult {
success: self.success, success: self.success,
spent_budget: self.spent_budget, spent_budget: self.spent_budget,
output: self.output, traces: self.traces,
logs: self.logs,
test: self.test, test: self.test,
assertion: self.assertion.and_then(|assertion| { assertion: self.assertion.and_then(|assertion| {
// No need to spend time/cpu on reifying assertions for successful // No need to spend time/cpu on reifying assertions for successful