Database.description tests

This commit is contained in:
Gwendal Roué committed 2020-06-03 19:37:34 +02:00
1 parent 780ba744f1
commit d55e16de3c
3 files changed
+15 -3

No files matched your search

@@ -872,6 +872,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
let dbPool = try makeDatabasePool()
dbPool.writeWithoutTransaction { db in
XCTAssertEqual(db.configuration.label, nil)
XCTAssertEqual(db.description, "GRDB.DatabasePool.writer")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -884,6 +885,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
let block1 = { () in
try! dbPool.read { db in
XCTAssertEqual(db.configuration.label, nil)
XCTAssertEqual(db.description, "GRDB.DatabasePool.reader.1")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -899,6 +901,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
try! dbPool.read { db in
_ = s2.signal()
XCTAssertEqual(db.configuration.label, nil)
XCTAssertEqual(db.description, "GRDB.DatabasePool.reader.2")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -917,6 +920,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
let dbPool = try makeDatabasePool()
dbPool.writeWithoutTransaction { db in
XCTAssertEqual(db.configuration.label, "Toreador")
XCTAssertEqual(db.description, "Toreador.writer")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -929,6 +933,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
let block1 = { () in
try! dbPool.read { db in
XCTAssertEqual(db.configuration.label, "Toreador")
XCTAssertEqual(db.description, "Toreador.reader.1")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -944,6 +949,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
try! dbPool.read { db in
_ = s2.signal()
XCTAssertEqual(db.configuration.label, "Toreador")
XCTAssertEqual(db.description, "Toreador.reader.2")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -1319,7 +1325,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
}
return dbPool!
}
// Test for sample code in Documentation/SharingADatabase.md.
// This test passes if this method compiles
private func openDatabase(at databaseURL: URL) throws -> DatabasePool {
@@ -1348,7 +1354,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
}
return dbPool
}
// Test for sample code in Documentation/SharingADatabase.md.
// This test passes if this method compiles
private func openReadOnlyDatabase(at databaseURL: URL) throws -> DatabasePool? {
+3 -1
View File
@@ -54,7 +54,7 @@ class DatabaseQueueTests: GRDBTestCase {
XCTAssertEqual(error.description.lowercased(), "sqlite error 1 with statement `select succ(1)`: no such function: succ")
}
}
func testAddRemoveCollation() throws {
// Adding a collation and then removing it should succeed
let dbQueue = try makeDatabaseQueue()
@@ -100,6 +100,7 @@ class DatabaseQueueTests: GRDBTestCase {
XCTAssertEqual(dbQueue.configuration.label, nil)
dbQueue.inDatabase { db in
XCTAssertEqual(db.configuration.label, nil)
XCTAssertEqual(db.description, "GRDB.DatabaseQueue")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -114,6 +115,7 @@ class DatabaseQueueTests: GRDBTestCase {
XCTAssertEqual(dbQueue.configuration.label, "Toreador")
dbQueue.inDatabase { db in
XCTAssertEqual(db.configuration.label, "Toreador")
XCTAssertEqual(db.description, "Toreador")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -201,6 +201,7 @@ class DatabaseSnapshotTests: GRDBTestCase {
let snapshot1 = try dbPool.makeSnapshot()
snapshot1.unsafeRead { db in
XCTAssertEqual(db.configuration.label, nil)
XCTAssertEqual(db.description, "GRDB.DatabasePool.snapshot.1")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -211,6 +212,7 @@ class DatabaseSnapshotTests: GRDBTestCase {
let snapshot2 = try dbPool.makeSnapshot()
snapshot2.unsafeRead { db in
XCTAssertEqual(db.configuration.label, nil)
XCTAssertEqual(db.description, "GRDB.DatabasePool.snapshot.2")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -226,6 +228,7 @@ class DatabaseSnapshotTests: GRDBTestCase {
let snapshot1 = try dbPool.makeSnapshot()
snapshot1.unsafeRead { db in
XCTAssertEqual(db.configuration.label, "Toreador")
XCTAssertEqual(db.description, "Toreador.snapshot.1")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.
@@ -236,6 +239,7 @@ class DatabaseSnapshotTests: GRDBTestCase {
let snapshot2 = try dbPool.makeSnapshot()
snapshot2.unsafeRead { db in
XCTAssertEqual(db.configuration.label, "Toreador")
XCTAssertEqual(db.description, "Toreador.snapshot.2")
// This test CAN break in future releases: the dispatch queue labels
// are documented to be a debug-only tool.