gitbutler/crates/gitbutler-core/tests/database/mod.rs
Sebastian Thiel 72291ce4cb
chore: align 'app' and 'lib' crates imports.
This is done one-time (for now) using a nightly feature of cargo-fmt
as defined in `rustfmt-nightly.toml.`

It's planned to make this the default so imports will always be sorted.
For now it can be run manually with:
    cargo +nightly fmt -- --config-path rustfmt-nightly.toml
or
    pnpm rustfmtTBD
 Please enter the message for your patch. Lines starting with
2024-03-30 22:43:16 +01:00

22 lines
655 B
Rust

use gitbutler_core::database::Database;
use crate::shared::temp_dir;
#[test]
fn smoke() {
let data_dir = temp_dir();
let db = Database::open_in_directory(data_dir.path()).unwrap();
db.transaction(|tx| {
tx.execute("CREATE TABLE test (id INTEGER PRIMARY KEY)", [])
.unwrap();
tx.execute("INSERT INTO test (id) VALUES (1)", []).unwrap();
let mut stmt = tx.prepare("SELECT id FROM test").unwrap();
let mut rows = stmt.query([]).unwrap();
let row = rows.next().unwrap().unwrap();
let id: i32 = row.get(0).unwrap();
assert_eq!(id, 1_i32);
Ok(())
})
.unwrap();
}