File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,23 @@ class DatabaseReaderTests : GRDBTestCase {
363363#endif
364364 }
365365
366+ func testUnsafeReadCanAccessTaskLocal( ) async throws {
367+ func test( _ dbReader: some DatabaseReader ) async throws {
368+ let expectedUUID = UUID ( )
369+ let dbUUID = try await $localUUID. withValue ( expectedUUID) {
370+ try await dbReader. unsafeRead { db in localUUID }
371+ }
372+ XCTAssertEqual ( dbUUID, expectedUUID)
373+ }
374+
375+ try await test ( makeDatabaseQueue ( ) )
376+ try await test ( makeDatabasePool ( ) )
377+ try await test ( makeDatabasePool ( ) . makeSnapshot ( ) )
378+ #if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
379+ try await test ( makeDatabasePool ( ) . makeSnapshotPool ( ) )
380+ #endif
381+ }
382+
366383 // MARK: - Task Cancellation
367384
368385 func test_read_is_cancelled_by_Task_cancellation_performed_before_database_access( ) async throws {
You can’t perform that action at this time.
0 commit comments