@@ -15,15 +15,12 @@ class FTSIntegrationTests: SQLiteTestCase {
15
15
let index = VirtualTable ( " index " )
16
16
17
17
private func createIndex( ) throws {
18
- do {
18
+ try createOrSkip { db in
19
19
try db. run ( index. create ( . FTS5(
20
20
FTS5Config ( )
21
21
. column ( email)
22
22
. tokenizer ( . Unicode61( ) ) )
23
23
) )
24
- } catch let error as Result {
25
- try XCTSkipIf ( error. description. starts ( with: " no such model " ) )
26
- throw error
27
24
}
28
25
29
26
for user in try db. prepare ( users) {
@@ -32,16 +29,12 @@ class FTSIntegrationTests: SQLiteTestCase {
32
29
}
33
30
34
31
private func createTrigramIndex( ) throws {
35
- do {
32
+ try createOrSkip { db in
36
33
try db. run ( index. create ( . FTS5(
37
34
FTS5Config ( )
38
35
. column ( email)
39
36
. tokenizer ( . Trigram( caseSensitive: false ) ) )
40
37
) )
41
- } catch let error as Result {
42
- try XCTSkipIf ( error. description. starts ( with: " no such model " ) ||
43
- error. description. starts ( with: " parse error in " ) )
44
- throw error
45
38
}
46
39
47
40
for user in try db. prepare ( users) {
@@ -73,4 +66,15 @@ class FTSIntegrationTests: SQLiteTestCase {
73
66
let matches = Array ( try db. prepare ( index. match ( " Paul " ) ) )
74
67
XCTAssertEqual ( 1 , matches. count)
75
68
}
69
+
70
+ private func createOrSkip( _ createIndex: ( Connection ) throws -> Void ) throws {
71
+ do {
72
+ try createIndex ( db)
73
+ } catch let error as Result {
74
+ try XCTSkipIf ( error. description. starts ( with: " no such module: " ) ||
75
+ error. description. starts ( with: " parse error " )
76
+ )
77
+ throw error
78
+ }
79
+ }
76
80
}
0 commit comments