mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
1 parent
f93e7579bc
commit
59fed5c756
1 file changed
+15
-1
@@ -46,7 +46,7 @@ class FTS3Tests: GRDBTestCase {
|
||||
// Logical queries
|
||||
("years NOT months", 1),
|
||||
("years AND months", 1),
|
||||
("years OR months", 2)
|
||||
("years OR months", 2),
|
||||
]
|
||||
for (rawPattern, expectedCount) in validRawPatterns {
|
||||
let pattern = try FTS3Pattern(rawPattern: rawPattern)
|
||||
@@ -56,4 +56,18 @@ class FTS3Tests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testInvalidFTS3Pattern() {
|
||||
let invalidRawPatterns = ["NOT", "(", "AND", "OR", "\""]
|
||||
for rawPattern in invalidRawPatterns {
|
||||
do {
|
||||
_ = try FTS3Pattern(rawPattern: rawPattern)
|
||||
XCTFail("Expected pattern to be invalid: \(String(reflecting: rawPattern))")
|
||||
} catch is DatabaseError {
|
||||
|
||||
} catch {
|
||||
XCTFail("Expected DatabaseError, not \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user