mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
Remove two invalid tests that use cursor outside of their protected dispatch queue
This commit is contained in:
1 parent
dd4b651938
commit
ad61c72988
2 files changed
-66
No files matched your search
@@ -188,39 +188,6 @@ class DatabasePoolReleaseMemoryTests: GRDBTestCase {
|
||||
XCTAssertEqual(openConnectionCount, 0)
|
||||
}
|
||||
|
||||
// TODO: this test should be duplicated for all cursor types
|
||||
func testDatabaseCursorRetainSQLiteConnection() throws {
|
||||
let countQueue = DispatchQueue(label: "GRDB")
|
||||
var openConnectionCount = 0
|
||||
|
||||
dbConfiguration.SQLiteConnectionDidOpen = {
|
||||
countQueue.sync {
|
||||
openConnectionCount += 1
|
||||
}
|
||||
}
|
||||
|
||||
dbConfiguration.SQLiteConnectionDidClose = {
|
||||
countQueue.sync {
|
||||
openConnectionCount -= 1
|
||||
}
|
||||
}
|
||||
|
||||
var cursor: FastDatabaseValueCursor<Int>? = nil
|
||||
do {
|
||||
try! makeDatabasePool().write { db in
|
||||
try db.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
|
||||
try db.execute("INSERT INTO items (id) VALUES (NULL)")
|
||||
try db.execute("INSERT INTO items (id) VALUES (NULL)")
|
||||
cursor = try Int.fetchCursor(db, "SELECT id FROM items")
|
||||
XCTAssertTrue(try cursor!.next() != nil)
|
||||
XCTAssertEqual(openConnectionCount, 1)
|
||||
}
|
||||
}
|
||||
XCTAssertEqual(openConnectionCount, 0)
|
||||
XCTAssertTrue(try! cursor!.next() != nil)
|
||||
XCTAssertTrue(try! cursor!.next() == nil)
|
||||
}
|
||||
|
||||
func testStatementDoNotRetainDatabaseConnection() throws {
|
||||
// Block 1 Block 2
|
||||
// create statement INSERT
|
||||
|
||||
@@ -102,39 +102,6 @@ class DatabaseQueueReleaseMemoryTests: GRDBTestCase {
|
||||
// All connections are closed
|
||||
XCTAssertEqual(openConnectionCount, 0)
|
||||
}
|
||||
|
||||
// TODO: this test should be duplicated for all cursor types
|
||||
func testDatabaseCursorRetainSQLiteConnection() throws {
|
||||
let countQueue = DispatchQueue(label: "GRDB")
|
||||
var openConnectionCount = 0
|
||||
|
||||
dbConfiguration.SQLiteConnectionDidOpen = {
|
||||
countQueue.sync {
|
||||
openConnectionCount += 1
|
||||
}
|
||||
}
|
||||
|
||||
dbConfiguration.SQLiteConnectionDidClose = {
|
||||
countQueue.sync {
|
||||
openConnectionCount -= 1
|
||||
}
|
||||
}
|
||||
|
||||
var cursor: FastDatabaseValueCursor<Int>? = nil
|
||||
do {
|
||||
try! makeDatabaseQueue().inDatabase { db in
|
||||
try db.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
|
||||
try db.execute("INSERT INTO items (id) VALUES (NULL)")
|
||||
try db.execute("INSERT INTO items (id) VALUES (NULL)")
|
||||
cursor = try Int.fetchCursor(db, "SELECT id FROM items")
|
||||
XCTAssertTrue(try cursor!.next() != nil)
|
||||
XCTAssertEqual(openConnectionCount, 1)
|
||||
}
|
||||
}
|
||||
XCTAssertEqual(openConnectionCount, 0)
|
||||
XCTAssertTrue(try! cursor!.next() != nil)
|
||||
XCTAssertTrue(try! cursor!.next() == nil)
|
||||
}
|
||||
|
||||
func testStatementDoNotRetainDatabaseConnection() throws {
|
||||
// Block 1 Block 2
|
||||
|
||||
Reference in new issue
Block a user