mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Explicit tests that a DatabasePool can read from a new instance, and from a truncated wal file
This commit is contained in:
1 parent
d66d2118b5
commit
abd3ba39b1
1 file changed
+20
@@ -11,6 +11,26 @@ class DatabasePoolTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testCanReadFromNewInstance() throws {
|
||||
let dbPool = try makeDatabasePool()
|
||||
try dbPool.read { _ in }
|
||||
}
|
||||
|
||||
func testCanReadFromTruncatedWalFile() throws {
|
||||
do {
|
||||
let dbPool = try makeDatabasePool(filename: "test")
|
||||
try dbPool.writeWithoutTransaction { db in
|
||||
try db.execute(sql: "CREATE TABLE t(a)")
|
||||
try db.checkpoint(.truncate)
|
||||
}
|
||||
}
|
||||
do {
|
||||
let dbPool = try makeDatabasePool(filename: "test")
|
||||
let count = try dbPool.read(Table("t").fetchCount)
|
||||
XCTAssertEqual(count, 0)
|
||||
}
|
||||
}
|
||||
|
||||
func testPersistentWALModeEnabled() throws {
|
||||
let path: String
|
||||
do {
|
||||
|
||||
Reference in new issue
Block a user