mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-19 06:55:18 +01:00
Add more tests for vtab impl
This commit is contained in:
@@ -16,13 +16,12 @@ register_extension! {
|
||||
#[derive(VTabModuleDerive, Default)]
|
||||
pub struct KVStoreVTab;
|
||||
|
||||
/// The cursor holds a snapshot of (rowid, key, value) in memory.
|
||||
/// the cursor holds a snapshot of (rowid, key, value) in memory.
|
||||
pub struct KVStoreCursor {
|
||||
rows: Vec<(i64, String, String)>,
|
||||
index: Option<usize>,
|
||||
}
|
||||
|
||||
/// Implementing the VTabModule trait for KVStoreVTab
|
||||
impl VTabModule for KVStoreVTab {
|
||||
type VCursor = KVStoreCursor;
|
||||
const VTAB_KIND: VTabKind = VTabKind::VirtualTable;
|
||||
|
||||
@@ -531,6 +531,15 @@ def test_kv(pipe):
|
||||
returns_null,
|
||||
"can delete from empty table without error",
|
||||
)
|
||||
for i in range(100):
|
||||
write_to_pipe(pipe, f"insert into t values ('key{i}', 'val{i}');")
|
||||
run_test(
|
||||
pipe, "select count(*) from t;", lambda res: "100" == res, "can insert 100 rows"
|
||||
)
|
||||
run_test(pipe, "delete from t limit 96;", returns_null, "can delete 96 rows")
|
||||
run_test(
|
||||
pipe, "select count(*) from t;", lambda res: "4" == res, "four rows remain"
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user