From 0698249c5e32059a6f9dcb0f2bb9cac67a4d5eae Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Mon, 2 Jun 2025 15:01:51 +0200 Subject: [PATCH] test_delete_with_index --- .../query_processing/test_write_path.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/integration/query_processing/test_write_path.rs b/tests/integration/query_processing/test_write_path.rs index 624fcca55..edebd2821 100644 --- a/tests/integration/query_processing/test_write_path.rs +++ b/tests/integration/query_processing/test_write_path.rs @@ -428,6 +428,25 @@ fn test_update_with_index() -> anyhow::Result<()> { Ok(()) } +#[test] +fn test_delete_with_index() -> anyhow::Result<()> { + let _ = env_logger::try_init(); + + maybe_setup_tracing(); + + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t(x UNIQUE)"); + let conn = tmp_db.connect_limbo(); + + run_query(&tmp_db, &conn, "INSERT INTO t VALUES (1), (2)")?; + run_query(&tmp_db, &conn, "DELETE FROM t WHERE x >= 1")?; + + run_query_on_row(&tmp_db, &conn, "SELECT * FROM t", |_| { + panic!("Delete should've deleted every row!"); + })?; + + Ok(()) +} + fn run_query(tmp_db: &TempDatabase, conn: &Rc, query: &str) -> anyhow::Result<()> { run_query_core(tmp_db, conn, query, None::) }