fix #9
This commit is contained in:
@@ -275,7 +275,9 @@ fn fn_of_fn() {
|
|||||||
|
|
||||||
assert!(res.is_some());
|
assert!(res.is_some());
|
||||||
assert_eq!(res.unwrap(), 6.);
|
assert_eq!(res.unwrap(), 6.);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
panic!("Cell not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -287,7 +289,9 @@ fn circular_reference_cells() {
|
|||||||
if let Some(cell) = grid.get_cell("A0") {
|
if let Some(cell) = grid.get_cell("A0") {
|
||||||
let res = grid.evaluate(&cell.to_string());
|
let res = grid.evaluate(&cell.to_string());
|
||||||
assert!(res.is_none());
|
assert!(res.is_none());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
panic!("Cell not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -305,5 +309,22 @@ fn fn_of_fn_one_shot() {
|
|||||||
|
|
||||||
assert!(res.is_some());
|
assert!(res.is_some());
|
||||||
assert_eq!(res.unwrap(), 9.);
|
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");
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ impl<'a> Context for CallbackContext<'a, DefaultNumericTypes> {
|
|||||||
|
|
||||||
match v {
|
match v {
|
||||||
super::calc::CellType::Number(n) => return Some(Value::Float(n.to_owned())),
|
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) => {
|
super::calc::CellType::Equation(eq) => {
|
||||||
if let Ok(mut depth) = self.eval_depth.write() {
|
if let Ok(mut depth) = self.eval_depth.write() {
|
||||||
*depth += 1;
|
*depth += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user