From cd4e5a3076cd9365c65d1a9243910169ada70ef2 Mon Sep 17 00:00:00 2001 From: Rushmore75 Date: Tue, 11 Nov 2025 09:42:09 -0700 Subject: [PATCH] fix #9 --- src/app/calc.rs | 21 +++++++++++++++++++++ src/app/ctx.rs | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/app/calc.rs b/src/app/calc.rs index 69833f7..7028874 100644 --- a/src/app/calc.rs +++ b/src/app/calc.rs @@ -275,7 +275,9 @@ fn fn_of_fn() { assert!(res.is_some()); assert_eq!(res.unwrap(), 6.); + return; } + panic!("Cell not found"); } #[test] @@ -287,7 +289,9 @@ fn circular_reference_cells() { if let Some(cell) = grid.get_cell("A0") { let res = grid.evaluate(&cell.to_string()); assert!(res.is_none()); + return; } + panic!("Cell not found"); } #[test] @@ -305,5 +309,22 @@ fn fn_of_fn_one_shot() { assert!(res.is_some()); assert_eq!(res.unwrap(), 9.); + return; } + panic!("Cell not found"); +} + +#[test] +fn cell_ref_string() { + let mut grid = Grid::new(); + grid.set_cell("A0", 2.); + grid.set_cell("B0", "=A0".to_string()); + + if let Some(cell) = grid.get_cell("A0") { + let res = grid.evaluate(&cell.to_string()); + + assert!(res.is_none()); + return; + } + panic!("Cell not found"); } \ No newline at end of file diff --git a/src/app/ctx.rs b/src/app/ctx.rs index 2b6a612..df58c22 100644 --- a/src/app/ctx.rs +++ b/src/app/ctx.rs @@ -45,7 +45,7 @@ impl<'a> Context for CallbackContext<'a, DefaultNumericTypes> { match v { super::calc::CellType::Number(n) => return Some(Value::Float(n.to_owned())), - super::calc::CellType::String(s) => unimplemented!("{s}"), + super::calc::CellType::String(_) => return None, super::calc::CellType::Equation(eq) => { if let Ok(mut depth) = self.eval_depth.write() { *depth += 1;