Add tests for hes_rowid field

Signed-off-by: Piotr Jastrzebski <haaawk@gmail.com>
This commit is contained in:
Piotr Jastrzebski
2024-07-07 14:51:22 +02:00
parent 50ecea0c86
commit 73e037afa2

View File

@@ -301,6 +301,22 @@ pub fn sqlite_schema_table() -> BTreeTable {
mod tests {
use super::*;
#[test]
pub fn test_has_rowid_true() -> Result<()> {
let sql = r#"CREATE TABLE t1 (a INTEGER PRIMARY KEY, b TEXT);"#;
let table = BTreeTable::from_sql(sql, 0)?;
assert!(table.has_rowid, "has_rowid should be set to true");
Ok(())
}
#[test]
pub fn test_has_rowid_false() -> Result<()> {
let sql = r#"CREATE TABLE t1 (a INTEGER PRIMARY KEY, b TEXT) WITHOUT ROWID;"#;
let table = BTreeTable::from_sql(sql, 0)?;
assert!(!table.has_rowid, "has_rowid should be set to false");
Ok(())
}
#[test]
pub fn test_sqlite_schema() {
let expected = r#"CREATE TABLE sqlite_schema (