mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-17 00:24:21 +01:00
adjust testing extension to add some test assertions for new features
This commit is contained in:
@@ -53,6 +53,7 @@ impl VTabModule for KVStoreVTabModule {
|
|||||||
schema,
|
schema,
|
||||||
KVStoreTable {
|
KVStoreTable {
|
||||||
store: Rc::new(RefCell::new(BTreeMap::new())),
|
store: Rc::new(RefCell::new(BTreeMap::new())),
|
||||||
|
in_tx: false,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -152,6 +153,7 @@ impl VTabCursor for KVStoreCursor {
|
|||||||
|
|
||||||
pub struct KVStoreTable {
|
pub struct KVStoreTable {
|
||||||
store: Store,
|
store: Store,
|
||||||
|
in_tx: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VTable for KVStoreTable {
|
impl VTable for KVStoreTable {
|
||||||
@@ -167,6 +169,31 @@ impl VTable for KVStoreTable {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn begin(&mut self) -> Result<(), Self::Error> {
|
||||||
|
assert!(!self.in_tx, "Already in a transaction");
|
||||||
|
self.in_tx = true;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn commit(&mut self) -> Result<(), Self::Error> {
|
||||||
|
assert!(self.in_tx, "Not in a transaction");
|
||||||
|
self.in_tx = false;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rollback(&mut self) -> Result<(), Self::Error> {
|
||||||
|
assert!(self.in_tx, "Not in a transaction");
|
||||||
|
self.in_tx = false;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rename(&mut self, new_name: &str) -> Result<(), Self::Error> {
|
||||||
|
// not a real extension of course, just asserting test in
|
||||||
|
// testing/cli_tests/extensions.py
|
||||||
|
assert_eq!(new_name, "renamed");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn best_index(
|
fn best_index(
|
||||||
constraints: &[ConstraintInfo],
|
constraints: &[ConstraintInfo],
|
||||||
_order_by: &[OrderByInfo],
|
_order_by: &[OrderByInfo],
|
||||||
|
|||||||
Reference in New Issue
Block a user