From d66d2118b5fa4c17b185301db68eb7ae5727feb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Rou=C3=A9?= Date: Thu, 1 Jun 2023 17:05:06 +0200 Subject: [PATCH] Failing test for #1383 --- Tests/GRDBTests/ValueObservationTests.swift | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Tests/GRDBTests/ValueObservationTests.swift b/Tests/GRDBTests/ValueObservationTests.swift index f8c49fb7e..d6697df2c 100644 --- a/Tests/GRDBTests/ValueObservationTests.swift +++ b/Tests/GRDBTests/ValueObservationTests.swift @@ -1152,4 +1152,27 @@ class ValueObservationTests: GRDBTestCase { try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } } + + // Regression test for + func testIssue1383() 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 observation = ValueObservation.tracking(Table("t").fetchCount) + _ = observation.start( + in: dbPool, scheduling: .immediate, + onError: { error in + XCTFail("Unexpected error \(error)") + }, + onChange: { _ in + }) + } + } }