mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-22 04:00:39 +00:00
Enable more tests
This commit is contained in:
1 parent
f878d99733
commit
c35095c6da
5 files changed
+79
-5
No files matched your search
@@ -88,6 +88,9 @@ class FTS3TableBuilderTests: GRDBTestCase {
|
||||
|
||||
#if GRDBCUSTOMSQLITE || SQLITE_HAS_CODEC
|
||||
func testUnicode61TokenizerDiacriticsRemove() throws {
|
||||
guard Database.sqliteLibVersionNumber >= 3027000 else {
|
||||
throw XCTSkip("remove_diacritics=2 is not available")
|
||||
}
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(virtualTable: "documents", using: FTS3()) { t in
|
||||
@@ -99,7 +102,7 @@ class FTS3TableBuilderTests: GRDBTestCase {
|
||||
#else
|
||||
func testUnicode61TokenizerDiacriticsRemove() throws {
|
||||
guard #available(iOS 14, macOS 10.16, tvOS 14, *) else {
|
||||
throw XCTSkip()
|
||||
throw XCTSkip("remove_diacritics=2 is not available")
|
||||
}
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
|
||||
@@ -95,8 +95,35 @@ class FTS3TokenizerTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDBCUSTOMSQLITE
|
||||
#if GRDBCUSTOMSQLITE || SQLITE_HAS_CODEC
|
||||
func testUnicode61TokenizerDiacriticsRemove() throws {
|
||||
guard Database.sqliteLibVersionNumber >= 3027000 else {
|
||||
throw XCTSkip("remove_diacritics=2 is not available")
|
||||
}
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(virtualTable: "documents", using: FTS3()) { t in
|
||||
t.tokenizer = .unicode61(diacritics: .remove)
|
||||
}
|
||||
|
||||
// simple match
|
||||
XCTAssertTrue(match(db, "abcDÉF", "abcDÉF"))
|
||||
|
||||
// English stemming
|
||||
XCTAssertFalse(match(db, "database", "databases"))
|
||||
|
||||
// diacritics in latin characters
|
||||
XCTAssertTrue(match(db, "eéÉ", "Èèe"))
|
||||
|
||||
// unicode case
|
||||
XCTAssertTrue(match(db, "jérôme", "JÉRÔME"))
|
||||
}
|
||||
}
|
||||
#else
|
||||
func testUnicode61TokenizerDiacriticsRemove() throws {
|
||||
guard #available(iOS 14, macOS 10.16, tvOS 14, *) else {
|
||||
throw XCTSkip("remove_diacritics=2 is not available")
|
||||
}
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(virtualTable: "documents", using: FTS3()) { t in
|
||||
|
||||
@@ -87,8 +87,24 @@ class FTS4TableBuilderTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
// TODO: why only custom SQLite build?
|
||||
#if GRDBCUSTOMSQLITE
|
||||
#if GRDBCUSTOMSQLITE || SQLITE_HAS_CODEC
|
||||
func testUnicode61TokenizerDiacriticsRemove() throws {
|
||||
guard Database.sqliteLibVersionNumber >= 3027000 else {
|
||||
throw XCTSkip("remove_diacritics=2 is not available")
|
||||
}
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(virtualTable: "documents", using: FTS4()) { t in
|
||||
t.tokenizer = .unicode61(diacritics: .remove)
|
||||
}
|
||||
assertDidExecute(sql: "CREATE VIRTUAL TABLE \"documents\" USING fts4(tokenize=unicode61 \"remove_diacritics=2\")")
|
||||
}
|
||||
}
|
||||
#else
|
||||
func testUnicode61TokenizerDiacriticsRemove() throws {
|
||||
guard #available(iOS 14, macOS 10.16, tvOS 14, *) else {
|
||||
throw XCTSkip("remove_diacritics=2 is not available")
|
||||
}
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(virtualTable: "documents", using: FTS4()) { t in
|
||||
|
||||
@@ -160,7 +160,7 @@ class FTS5TableBuilderTests: GRDBTestCase {
|
||||
#else
|
||||
func testUnicode61TokenizerDiacriticsRemove() throws {
|
||||
guard #available(iOS 14, macOS 10.16, tvOS 14, *) else {
|
||||
throw XCTSkip()
|
||||
throw XCTSkip("remove_diacritics=2 is not available")
|
||||
}
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
|
||||
@@ -173,8 +173,36 @@ class FTS5TokenizerTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDBCUSTOMSQLITE
|
||||
#if GRDBCUSTOMSQLITE || SQLITE_HAS_CODEC
|
||||
func testUnicode61TokenizerDiacriticsRemove() throws {
|
||||
guard Database.sqliteLibVersionNumber >= 3027000 else {
|
||||
throw XCTSkip("remove_diacritics=2 is not available")
|
||||
}
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(virtualTable: "documents", using: FTS5()) { t in
|
||||
t.tokenizer = .unicode61(diacritics: .remove)
|
||||
t.column("content")
|
||||
}
|
||||
|
||||
// simple match
|
||||
XCTAssertTrue(match(db, "abcDÉF", "abcDÉF"))
|
||||
|
||||
// English stemming
|
||||
XCTAssertFalse(match(db, "database", "databases"))
|
||||
|
||||
// diacritics in latin characters
|
||||
XCTAssertTrue(match(db, "eéÉ", "Èèe"))
|
||||
|
||||
// unicode case
|
||||
XCTAssertTrue(match(db, "jérôme", "JÉRÔME"))
|
||||
}
|
||||
}
|
||||
#else
|
||||
func testUnicode61TokenizerDiacriticsRemove() throws {
|
||||
guard #available(iOS 14, macOS 10.16, tvOS 14, *) else {
|
||||
throw XCTSkip("remove_diacritics=2 is not available")
|
||||
}
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(virtualTable: "documents", using: FTS5()) { t in
|
||||
|
||||
Reference in new issue
Block a user