mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Add fundamental test for #929
This commit is contained in:
1 parent
b17fce357d
commit
96df69b3fb
1 file changed
+10
@@ -165,6 +165,16 @@ class QueryInterfaceExpressionsTests: GRDBTestCase {
|
||||
func testContainsWithCollation() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
|
||||
try dbQueue.read { db in
|
||||
// Reminder of the SQLite behavior
|
||||
// https://sqlite.org/datatype3.html#assigning_collating_sequences_from_sql
|
||||
// > If an explicit collating sequence is required on an IN operator
|
||||
// > it should be applied to the left operand, like this:
|
||||
// > "x COLLATE nocase IN (y,z, ...)".
|
||||
try XCTAssertFalse(Bool.fetchOne(db, sql: "SELECT 'arthur' IN ('ARTHUR') COLLATE NOCASE")!)
|
||||
try XCTAssertTrue(Bool.fetchOne(db, sql: "SELECT 'arthur' COLLATE NOCASE IN ('ARTHUR')")!)
|
||||
}
|
||||
|
||||
// Array.contains(): IN operator
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.filter(["arthur", "barbara"].contains(Col.name.collating(.nocase)))),
|
||||
|
||||
Reference in new issue
Block a user