From f1eb48b0cfc6cab3daa8157495dbbfa606e14510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Rou=C3=A9?= Date: Wed, 10 Jun 2026 12:48:53 +0200 Subject: [PATCH] Fix a warning in Version 27.0 beta --- .../ValueObservationTests.swift | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Tests/GRDBTests/ValueObservation/ValueObservationTests.swift b/Tests/GRDBTests/ValueObservation/ValueObservationTests.swift index e884fc2a0..929b46867 100644 --- a/Tests/GRDBTests/ValueObservation/ValueObservationTests.swift +++ b/Tests/GRDBTests/ValueObservation/ValueObservationTests.swift @@ -1016,18 +1016,23 @@ class ValueObservationTests: GRDBTestCase { return "cancelled loop" } - // Lanch the task that cancels + // Launch the task that cancels Task { - let observation = ValueObservation.trackingConstantRegion(Table("t").fetchCount) - for try await count in observation.values(in: writer) { - if count >= 3 { - cancelledTask.cancel() - break - } else { - try await writer.write { - try $0.execute(sql: "INSERT INTO t DEFAULT VALUES") + do { + let observation = ValueObservation.trackingConstantRegion(Table("t").fetchCount) + for try await count in observation.values(in: writer) { + if count >= 3 { + cancelledTask.cancel() + break + } else { + try await writer.write { + try $0.execute(sql: "INSERT INTO t DEFAULT VALUES") + } } } + } catch { + XCTFail("Unexpected error: \(error)") + cancelledTask.cancel() } }