Skip to content

Commit 4233cc2

Browse files
committed
Fixes
1 parent 940a32f commit 4233cc2

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

Tests/StructuredQueriesTests/DatabaseCollationTests.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import Dependencies
22
import Foundation
33
import InlineSnapshotTesting
4-
import SQLite3
54
import StructuredQueries
65
import StructuredQueriesSQLite
76
import StructuredQueriesTestSupport
87
import Testing
98
import _StructuredQueriesSQLite
109

10+
#if canImport(Darwin)
11+
import SQLite3
12+
#else
13+
import _StructuredQueriesSQLite3
14+
#endif
15+
1116
extension SnapshotTests {
1217
@Suite struct DatabaseCollationTests {
1318
@Dependency(\.defaultDatabase) var database
@@ -66,16 +71,15 @@ extension SnapshotTests {
6671
}
6772
}
6873
@Test func deallocatedOwner() {
69-
func makeCollation() -> some DatabaseCollation {
70-
Engine().$reversed
71-
}
72-
let collation = makeCollation()
73-
collation.install(database.handle)
74+
var engines = [Engine()]
75+
let reversed = engines[0].$reversed
76+
reversed.install(database.handle)
77+
engines.removeAll()
7478
// NB: A collating sequence cannot surface an error to SQLite, so the deallocated engine is
7579
// reported as an issue and the comparison falls back to a byte-wise one.
7680
withKnownIssue {
7781
assertQuery(
78-
RemindersList.select(\.title).order { $0.title.collate(collation) }
82+
RemindersList.select(\.title).order { $0.title.collate(reversed) }
7983
) {
8084
"""
8185
SELECT "remindersLists"."title"

0 commit comments

Comments
 (0)