mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 09:04:19 +01:00
fix tests
This commit is contained in:
@@ -5398,7 +5398,6 @@ impl BTreeCursor {
|
||||
let mut mem_page;
|
||||
let mut contents;
|
||||
|
||||
loop {
|
||||
let state = self.count_state;
|
||||
match state {
|
||||
CountState::Start => {
|
||||
@@ -5409,6 +5408,7 @@ impl BTreeCursor {
|
||||
CountState::Loop => {
|
||||
mem_page_rc = self.stack.top();
|
||||
mem_page = mem_page_rc.get();
|
||||
return_if_locked_maybe_load!(self.pager, mem_page_rc);
|
||||
turso_assert!(mem_page.is_loaded(), "page should be loaded");
|
||||
contents = mem_page.get().contents.as_ref().unwrap();
|
||||
|
||||
@@ -5438,6 +5438,7 @@ impl BTreeCursor {
|
||||
|
||||
mem_page_rc = self.stack.top();
|
||||
mem_page = mem_page_rc.get();
|
||||
return_if_locked_maybe_load!(self.pager, mem_page_rc);
|
||||
turso_assert!(mem_page.is_loaded(), "page should be loaded");
|
||||
contents = mem_page.get().contents.as_ref().unwrap();
|
||||
|
||||
@@ -5468,12 +5469,10 @@ impl BTreeCursor {
|
||||
|
||||
match cell {
|
||||
BTreeCell::TableInteriorCell(TableInteriorCell {
|
||||
left_child_page,
|
||||
..
|
||||
left_child_page, ..
|
||||
})
|
||||
| BTreeCell::IndexInteriorCell(IndexInteriorCell {
|
||||
left_child_page,
|
||||
..
|
||||
left_child_page, ..
|
||||
}) => {
|
||||
self.stack.advance();
|
||||
let (mem_page, _c) = self.read_page(left_child_page as usize)?;
|
||||
@@ -5489,7 +5488,6 @@ impl BTreeCursor {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Save cursor context, to be restored later
|
||||
pub fn save_context(&mut self, cursor_context: CursorContext) {
|
||||
|
||||
@@ -617,12 +617,12 @@ fn test_bind_parameters_update_rowid_alias_seek_rowid() -> anyhow::Result<()> {
|
||||
row.get::<&Value>(2).unwrap(),
|
||||
&Value::Integer(if i == 0 { 4 } else { 11 })
|
||||
);
|
||||
i += 1;
|
||||
}
|
||||
StepResult::IO => sel.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
StepResult::Busy => panic!("database busy"),
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
let mut ins = conn.prepare("update test set name = ? where id < ? AND age between ? and ?;")?;
|
||||
ins.bind_at(1.try_into()?, Value::build_text("updated"));
|
||||
@@ -648,12 +648,12 @@ fn test_bind_parameters_update_rowid_alias_seek_rowid() -> anyhow::Result<()> {
|
||||
row.get::<&Value>(0).unwrap(),
|
||||
&Value::build_text(if i == 0 { "updated" } else { "test" }),
|
||||
);
|
||||
i += 1;
|
||||
}
|
||||
StepResult::IO => sel.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
StepResult::Busy => panic!("database busy"),
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
||||
assert_eq!(ins.parameters().count(), 4);
|
||||
@@ -692,12 +692,12 @@ fn test_bind_parameters_delete_rowid_alias_seek_out_of_order() -> anyhow::Result
|
||||
StepResult::Row => {
|
||||
let row = sel.row().unwrap();
|
||||
assert_eq!(row.get::<&Value>(0).unwrap(), &Value::build_text("correct"),);
|
||||
i += 1;
|
||||
}
|
||||
StepResult::IO => sel.run_once()?,
|
||||
StepResult::Done | StepResult::Interrupt => break,
|
||||
StepResult::Busy => panic!("database busy"),
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
assert_eq!(i, 1);
|
||||
assert_eq!(ins.parameters().count(), 4);
|
||||
|
||||
Reference in New Issue
Block a user