mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-09 02:04:22 +01:00
sqlite3/test: Use tempfile in read frame test case
...make test runs idempotent, as suggested by Jussi.
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -1977,6 +1977,7 @@ dependencies = [
|
||||
"env_logger 0.11.7",
|
||||
"libc",
|
||||
"limbo_core",
|
||||
"tempfile",
|
||||
"tracing",
|
||||
"tracing-appender",
|
||||
"tracing-subscriber",
|
||||
|
||||
@@ -29,6 +29,9 @@ tracing = "0.1.41"
|
||||
tracing-appender = "0.2.3"
|
||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.8.0"
|
||||
|
||||
[package.metadata.capi.header]
|
||||
name = "sqlite3.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::ptr;
|
||||
|
||||
#[repr(C)]
|
||||
@@ -203,6 +204,8 @@ mod tests {
|
||||
|
||||
#[cfg(not(feature = "sqlite3"))]
|
||||
mod libsql_ext {
|
||||
use libc::tm;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
@@ -255,10 +258,10 @@ mod tests {
|
||||
fn test_read_frame() {
|
||||
unsafe {
|
||||
let mut db = ptr::null_mut();
|
||||
assert_eq!(
|
||||
sqlite3_open(c"../testing/test_read_frame.db".as_ptr(), &mut db),
|
||||
SQLITE_OK
|
||||
);
|
||||
let mut temp_file = tempfile::NamedTempFile::new().unwrap();
|
||||
let path = temp_file.path();
|
||||
let c_path = CString::new(path.to_str().unwrap()).unwrap();
|
||||
assert_eq!(sqlite3_open(c_path.as_ptr(), &mut db), SQLITE_OK);
|
||||
// Create a table and insert a row.
|
||||
let mut stmt = ptr::null_mut();
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user