From 829c938afc3e6ab0b2dafdcb8fa61f9bb1e9764c Mon Sep 17 00:00:00 2001 From: Samuel Maddock Date: Wed, 8 Jan 2025 17:20:35 -0500 Subject: [PATCH] fix: tests --- crates/symbolicli/src/main.rs | 4 ++-- crates/symbolicli/src/output.rs | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/crates/symbolicli/src/main.rs b/crates/symbolicli/src/main.rs index d91bc9948..3b371da13 100644 --- a/crates/symbolicli/src/main.rs +++ b/crates/symbolicli/src/main.rs @@ -727,8 +727,8 @@ mod event { function: value.function, filename: value.filename, module: value.module, - abs_path: value.abs_path?, - lineno: value.lineno?, + abs_path: value.abs_path, + lineno: value.lineno, colno: value.colno, pre_context: value.pre_context, context_line: value.context_line, diff --git a/crates/symbolicli/src/output.rs b/crates/symbolicli/src/output.rs index 47c871641..bdae053fb 100644 --- a/crates/symbolicli/src/output.rs +++ b/crates/symbolicli/src/output.rs @@ -240,7 +240,8 @@ fn print_compact_js(mut response: CompletedJsSymbolicationResponse) { let filename = filename.unwrap_or_default(); row.add_cell(cell!(filename)); - row.add_cell(cell!(lineno)); + let line = lineno.map(|line| line.to_string()).unwrap_or_default(); + row.add_cell(cell!(line)); let col = colno.map(|col| col.to_string()).unwrap_or_default(); row.add_cell(cell!(col)); @@ -290,10 +291,23 @@ fn print_pretty_js(mut response: CompletedJsSymbolicationResponse) { table.add_row(row![r->" File:", name]); } - if let Some(col) = *colno { - table.add_row(row![r->" Line/Column:", format!("{lineno}:{col}")]); - } else { - table.add_row(row![r->" Line:", format!("{lineno}")]); + match (colno, lineno) { + (Some(col), Some(line)) => { + // Both colno and lineno are Some + table.add_row(row![r->" Line/Column:", format!("{}:{}", line, col)]); + } + (Some(col), None) => { + // Only colno is Some + table.add_row(row![r->" Column:", format!("{}", col)]); + } + (None, Some(line)) => { + // Only lineno is Some + table.add_row(row![r->" Line:", format!("{}", line)]); + } + (None, None) => { + // Both colno and lineno are None + table.add_row(row![r->" Line/Column:", "N/A"]); + } } table.add_empty_row();