Skip to content

Commit

Permalink
Add Test for SQLite
Browse files Browse the repository at this point in the history
  • Loading branch information
JunfXiao committed Dec 24, 2024
1 parent c43ba0a commit 69ec792
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ mod tests {
use crate::database::ms_excel::MsExcelProvider;
use crate::database::odbc::FileDbProvider;
use crate::database::path::clean_and_ensure_path;
use crate::database::sqlite::SqliteProvider;
use odbc_api::{Environment, IntoParameter};
use std::fs;
use std::sync::LazyLock;
Expand Down Expand Up @@ -166,4 +167,24 @@ mod tests {
fs::remove_file(db_path).unwrap();
}
}

#[traced_test]
#[test]
fn test_sqlite() {
let path = clean_and_ensure_path("test.db").unwrap();
let db_path = &path;
if fs::metadata(db_path).is_ok() {
fs::remove_file(db_path).unwrap();
}

{
let mut provider = SqliteProvider::new();
provider.setup_by_path(&ENVIRONMENT, db_path, None).unwrap();

test_db(&mut provider);
}
if fs::metadata(db_path).is_ok() {
fs::remove_file(db_path).unwrap();
}
}
}

0 comments on commit 69ec792

Please sign in to comment.