mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
Failing test for #931
This commit is contained in:
1 parent
424df6dee3
commit
7623a96034
1 file changed
+23
@@ -52,4 +52,27 @@ class DatabasePoolTests: GRDBTestCase {
|
||||
XCTAssertFalse(fm.fileExists(atPath: path + "-wal"))
|
||||
XCTAssertFalse(fm.fileExists(atPath: path + "-shm"))
|
||||
}
|
||||
|
||||
// Regression test
|
||||
func testIssue931() throws {
|
||||
dbConfiguration.prepareDatabase { db in
|
||||
var flag: CInt = 0
|
||||
let code = withUnsafeMutablePointer(to: &flag) { flagP in
|
||||
sqlite3_file_control(db.sqliteConnection, nil, SQLITE_FCNTL_PERSIST_WAL, flagP)
|
||||
}
|
||||
guard code == SQLITE_OK else {
|
||||
throw DatabaseError(resultCode: ResultCode(rawValue: code))
|
||||
}
|
||||
}
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("v1", migrate: { _ in })
|
||||
migrator.eraseDatabaseOnSchemaChange = true
|
||||
try migrator.migrate(dbQueue)
|
||||
|
||||
// Trigger #931: the migrator creates a temporary database and
|
||||
// calls `sqlite3_file_control` as part of the preparation function.
|
||||
try migrator.migrate(dbQueue)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user