@@ -15,15 +15,12 @@ class FTSIntegrationTests: SQLiteTestCase {
1515 let index = VirtualTable ( " index " )
1616
1717 private func createIndex( ) throws {
18- do {
18+ try createOrSkip { db in
1919 try db. run ( index. create ( . FTS5(
2020 FTS5Config ( )
2121 . column ( email)
2222 . tokenizer ( . Unicode61( ) ) )
2323 ) )
24- } catch let error as Result {
25- try XCTSkipIf ( error. description. starts ( with: " no such model " ) )
26- throw error
2724 }
2825
2926 for user in try db. prepare ( users) {
@@ -32,16 +29,12 @@ class FTSIntegrationTests: SQLiteTestCase {
3229 }
3330
3431 private func createTrigramIndex( ) throws {
35- do {
32+ try createOrSkip { db in
3633 try db. run ( index. create ( . FTS5(
3734 FTS5Config ( )
3835 . column ( email)
3936 . tokenizer ( . Trigram( caseSensitive: false ) ) )
4037 ) )
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
4538 }
4639
4740 for user in try db. prepare ( users) {
@@ -73,4 +66,15 @@ class FTSIntegrationTests: SQLiteTestCase {
7366 let matches = Array ( try db. prepare ( index. match ( " Paul " ) ) )
7467 XCTAssertEqual ( 1 , matches. count)
7568 }
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+ }
7680}
0 commit comments