(dig,hpk) add test and fix for wrong dbs

This commit is contained in:
holger krekel
2019-07-18 11:16:38 +02:00
parent c7db15352a
commit 7b736fe635
3 changed files with 19 additions and 12 deletions

View File

@@ -998,6 +998,20 @@ fn test_chat() {
}
}
#[test]
fn test_wrong_db() {
unsafe {
let mut ctx = dc_context_new(Some(cb), std::ptr::null_mut(), std::ptr::null_mut());
let dir = tempdir().unwrap();
let dbfile = dir.path().join("db.sqlite");
std::fs::write(&dbfile, b"123").unwrap();
let dbfile_c = CString::new(dbfile.to_str().unwrap()).unwrap();
let res = dc_open(&mut ctx, dbfile_c.as_ptr(), std::ptr::null());
assert_eq!(res, 0);
}
}
#[test]
fn test_arr_to_string() {
let arr2: [uint32_t; 4] = [