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
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::<Vec<_>>()

View File

@ -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<U, T> TestResult<U, T> {
}
}
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<U, T> TestResult<U, T> {
pub struct UnitTestResult<T> {
pub success: bool,
pub spent_budget: ExBudget,
pub output: Option<Term<NamedDeBruijn>>,
pub logs: Vec<String>,
pub traces: Vec<String>,
pub test: UnitTest,
pub assertion: Option<Assertion<T>>,
}
@ -878,8 +876,7 @@ impl UnitTestResult<(Constant, Rc<Type>)> {
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