mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
add test with rowid=-1
- now limbo attempts to add with overflow and panic in this case
This commit is contained in:
parent
593febd9a4
commit
6cc1b778b4
1 changed files with 22 additions and 0 deletions
|
@ -81,3 +81,25 @@ fn test_last_insert_rowid_basic() -> anyhow::Result<()> {
|
|||
do_flush(&conn, &tmp_db)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_integer_primary_key() -> anyhow::Result<()> {
|
||||
let _ = env_logger::try_init();
|
||||
let tmp_db = TempDatabase::new("CREATE TABLE test_rowid (id INTEGER PRIMARY KEY);");
|
||||
let conn = tmp_db.connect_limbo();
|
||||
|
||||
for query in &[
|
||||
"INSERT INTO test_rowid VALUES (-1)",
|
||||
"INSERT INTO test_rowid VALUES (NULL)",
|
||||
] {
|
||||
let mut insert_query = conn.query(query)?.unwrap();
|
||||
loop {
|
||||
match insert_query.step()? {
|
||||
StepResult::IO => tmp_db.io.run_once()?,
|
||||
StepResult::Done => break,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue