This commit is contained in:
2025-11-11 09:42:09 -07:00
parent c09df8eb1f
commit cd4e5a3076
2 changed files with 22 additions and 1 deletions

View File

@@ -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");
}

View File

@@ -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;