From dffc4bbe5dda670ec5080382a7a58cced71787b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 31 Dec 2025 12:29:59 +0100 Subject: [PATCH] More Swift 6 paranoid tests --- .../NonSendableTests.swift | 11 ++++++++++- Tests/Swift6DefaultGRDBTests/NonSendableTests.swift | 11 ++++++++++- .../NonSendableTests.swift | 11 ++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Tests/Swift6ApprochableConcurrencyGRDBTests/NonSendableTests.swift b/Tests/Swift6ApprochableConcurrencyGRDBTests/NonSendableTests.swift index 27b315605..9f41dbc80 100644 --- a/Tests/Swift6ApprochableConcurrencyGRDBTests/NonSendableTests.swift +++ b/Tests/Swift6ApprochableConcurrencyGRDBTests/NonSendableTests.swift @@ -10,6 +10,15 @@ private class NonSendable { } @Suite struct NonSendableTests { + @Test func non_sendable_type_in_synchronous_database_access() throws { + let dbQueue = try DatabaseQueue() + let input = NonSendable(value: 0) + let output = try dbQueue.read { _ in + input + } + #expect(input === output) + } + @Test func non_sendable_type_sent_to_databaseReader_read() async throws { let dbQueue = try DatabaseQueue() let nonSendable = NonSendable(value: 0) @@ -45,7 +54,7 @@ private class NonSendable { } #expect(value == 0) } - + @Test func non_sendable_type_sent_to_databaseWriter_writeWithoutTransaction() async throws { let dbQueue = try DatabaseQueue() let nonSendable = NonSendable(value: 0) diff --git a/Tests/Swift6DefaultGRDBTests/NonSendableTests.swift b/Tests/Swift6DefaultGRDBTests/NonSendableTests.swift index 27b315605..9f41dbc80 100644 --- a/Tests/Swift6DefaultGRDBTests/NonSendableTests.swift +++ b/Tests/Swift6DefaultGRDBTests/NonSendableTests.swift @@ -10,6 +10,15 @@ private class NonSendable { } @Suite struct NonSendableTests { + @Test func non_sendable_type_in_synchronous_database_access() throws { + let dbQueue = try DatabaseQueue() + let input = NonSendable(value: 0) + let output = try dbQueue.read { _ in + input + } + #expect(input === output) + } + @Test func non_sendable_type_sent_to_databaseReader_read() async throws { let dbQueue = try DatabaseQueue() let nonSendable = NonSendable(value: 0) @@ -45,7 +54,7 @@ private class NonSendable { } #expect(value == 0) } - + @Test func non_sendable_type_sent_to_databaseWriter_writeWithoutTransaction() async throws { let dbQueue = try DatabaseQueue() let nonSendable = NonSendable(value: 0) diff --git a/Tests/Swift6MainActorIsolationGRDBTests/NonSendableTests.swift b/Tests/Swift6MainActorIsolationGRDBTests/NonSendableTests.swift index b7c525f14..fddde57ea 100644 --- a/Tests/Swift6MainActorIsolationGRDBTests/NonSendableTests.swift +++ b/Tests/Swift6MainActorIsolationGRDBTests/NonSendableTests.swift @@ -10,6 +10,15 @@ nonisolated private class NonSendable { } @Suite struct NonSendableTests { + @Test func non_sendable_type_in_synchronous_database_access() throws { + let dbQueue = try DatabaseQueue() + let input = NonSendable(value: 0) + let output = try dbQueue.read { _ in + input + } + #expect(input === output) + } + @Test func non_sendable_type_sent_to_databaseReader_read() async throws { let dbQueue = try DatabaseQueue() let nonSendable = NonSendable(value: 0) @@ -45,7 +54,7 @@ nonisolated private class NonSendable { } #expect(value == 0) } - + @Test func non_sendable_type_sent_to_databaseWriter_writeWithoutTransaction() async throws { let dbQueue = try DatabaseQueue() let nonSendable = NonSendable(value: 0)