mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 14:36:29 +03:00
Make dc_open arguments rusty
This commit is contained in:
@@ -462,12 +462,9 @@ mod tests {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use std::ffi::CStr;
|
||||
use tempfile::{tempdir, TempDir};
|
||||
|
||||
use crate::context::*;
|
||||
use crate::dc_tools::to_cstring;
|
||||
use crate::x::free;
|
||||
|
||||
#[test]
|
||||
fn test_peerstate_save_to_db() {
|
||||
@@ -522,16 +519,13 @@ mod tests {
|
||||
unsafe fn create_test_context() -> TestContext {
|
||||
let mut ctx = dc_context_new(Some(cb), std::ptr::null_mut(), std::ptr::null_mut());
|
||||
let dir = tempdir().unwrap();
|
||||
let dbfile = to_cstring(dir.path().join("db.sqlite").to_str().unwrap());
|
||||
assert_eq!(
|
||||
dc_open(&mut ctx, dbfile, std::ptr::null()),
|
||||
1,
|
||||
let dbfile = dir.path().join("db.sqlite");
|
||||
assert!(
|
||||
dc_open(&mut ctx, dbfile.to_str().unwrap(), None),
|
||||
"Failed to open {}",
|
||||
CStr::from_ptr(dbfile as *const _).to_str().unwrap()
|
||||
dbfile.to_str().unwrap()
|
||||
);
|
||||
|
||||
free(dbfile as *mut _);
|
||||
|
||||
TestContext { ctx: ctx, dir: dir }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user