This commit is contained in:
William Brown 2019-03-22 10:02:05 +10:00
parent 98e118d488
commit 81d61df9f7

View file

@ -386,12 +386,12 @@ impl BackendWriteTransaction {
}
pub fn backup(&self, audit: &mut AuditScope, dstPath: &str) -> Result<(), OperationError> {
//open connection to the destination
let result = self.conn.backup(rusqlite::DatabaseName::Main, dstPath, None);
let result = self
.conn
.backup(rusqlite::DatabaseName::Main, dstPath, None);
match result {
Ok(_) => Ok(()),
Err(e) => {
audit_log!(audit, "Error in sqlite {:?}", e);
@ -765,26 +765,20 @@ mod tests {
#[test]
fn test_backup_restore() {
run_test!(|audit: &mut AuditScope, be: &BackendWriteTransaction| {
let result = fs::remove_file(dbBackupFileName);
match result{
match result {
Err(e) => {
// if the error is the file is not found, thats what we want so continue,
// otherwise return the error
match e.kind(){
std::io::ErrorKind::NotFound => {},
_ => (),
}
},
match e.kind() {
std::io::ErrorKind::NotFound => {}
_ => (),
}
}
_ => (),
}
be.backup(audit, "./.backup_test.db").unwrap();
be.restore(audit).unwrap();