1use varar_core::error::StepFailure;
5
6pub fn render_failure(failure: &StepFailure, _source: &str, path: &str) -> String {
7 let error = &failure.error;
8 if let Some(cells) = error.as_cell_mismatch() {
9 let mut lines = vec![format!("Cell mismatch in {path}:")];
10 let failing: Vec<_> = cells.iter().filter(|c| !c.ok).collect();
11 if failing.is_empty() {
12 lines.push(" (no failing cells)".to_string());
13 }
14 for cell in failing {
15 lines.push(format!(
16 " line {} | column '{}' — expected: {:?}, actual: {:?}",
17 cell.span.start_line, cell.column, cell.expected, cell.actual
18 ));
19 }
20 return lines.join("\n");
21 }
22 error.message()
23}