Compare commits

2 Commits

Author SHA1 Message Date
9de22b9680 lol
All checks were successful
Test Rust project / test (ubuntu-latest, stable) (push) Successful in 46s
2026-02-09 14:16:35 -07:00
3f336578f5 Continue on #53, solve failing test
All checks were successful
Test Rust project / test (ubuntu-latest, stable) (push) Successful in 46s
2026-02-09 13:33:56 -07:00
3 changed files with 18 additions and 7 deletions

View File

@@ -763,14 +763,16 @@ fn fn_of_fn() {
grid.set_cell("C0", "=A0+B0".to_string());
grid.set_cell("D0", "=C0*2".to_string());
if let Some(cell) = grid.get_cell("D0") {
let cell = grid.get_cell("D0");
assert!(cell.is_some());
if let Some(cell) = cell {
let res = grid.evaluate(&cell.to_string());
assert!(res.is_ok());
assert_eq!(res.unwrap(), (6.).into());
return;
}
panic!("Cell not found");
}
// Two cells that have a circular dependency to solve for a value
@@ -780,12 +782,14 @@ fn circular_reference_cells() {
grid.set_cell("A0", "=B0".to_string());
grid.set_cell("B0", "=A0".to_string());
if let Some(cell) = grid.get_cell("A0") {
let cell = grid.get_cell("A0");
assert!(cell.is_some());
if let Some(cell) = cell {
let res = grid.evaluate(&cell.to_string());
assert!(res.is_err());
return;
}
panic!("Cell not found");
}
#[test]

View File

@@ -188,7 +188,14 @@ impl<'a> Context for CallbackContext<'a> {
return None;
}
e => panic!("> Error {e}\n> Equation: '{eq}'"),
e => {
let msg = format!("> Error {e}\n> Equation: '{eq}'");
#[cfg(debug_assertions)]
panic!("{msg}");
#[cfg(not(debug_assertions))]
eprintln!("{msg}");
},
}
}
}

View File

@@ -142,7 +142,7 @@ fn fit_cells() {
app.vars.insert("height".to_string(), 1.to_string());
let (x,y) = app.screen.how_many_cells_fit_in(&prelude::Rect::new(0, 0, 181, 14), &app.vars);
assert_eq!(x, 18);
assert_eq!(x, 19);
assert_eq!(y, 14);
}
@@ -156,7 +156,7 @@ fn scroll() {
// We have to check how many cells fit, because screen learns the width
// of the area by rumour here.
let (x,y) = app.screen.how_many_cells_fit_in(&prelude::Rect::new(0, 0, 181, 14), &app.vars);
assert_eq!(x, 18);
assert_eq!(x, 19);
assert_eq!(y, 14);
// we aren't scrolled at all yet