mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Update a few tests that have been broken by 64899e5a39.
(Some expressions which were not safely wrapped inside parenthesis now are wrapped inside parenthesis)
This commit is contained in:
1 parent
64899e5a39
commit
b9333fab34
4 files changed
+11
-11
No files matched your search
@@ -151,7 +151,7 @@ class MutablePersistableRecordDeleteTests: GRDBTestCase {
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE (\"name\" = 'Arthur')")
|
||||
|
||||
try Person.filter(sql: "id = 1").deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE id = 1")
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE (id = 1)")
|
||||
|
||||
try Person.select(Column("name")).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\"")
|
||||
|
||||
@@ -112,7 +112,7 @@ class QueryInterfaceExtensibilityTests: GRDBTestCase {
|
||||
default:
|
||||
XCTFail("Expected data blob")
|
||||
}
|
||||
XCTAssertEqual(self.lastSQLQuery, "SELECT CAST(\"text\" AS BLOB) FROM \"records\"")
|
||||
XCTAssertEqual(self.lastSQLQuery, "SELECT (CAST(\"text\" AS BLOB)) FROM \"records\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,21 +237,21 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.filter(sql: "id <> 1")),
|
||||
"SELECT * FROM \"readers\" WHERE id <> 1")
|
||||
"SELECT * FROM \"readers\" WHERE (id <> 1)")
|
||||
}
|
||||
|
||||
func testFilterLiteralWithPositionalArguments() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.filter(sql: "id <> ?", arguments: [1])),
|
||||
"SELECT * FROM \"readers\" WHERE id <> 1")
|
||||
"SELECT * FROM \"readers\" WHERE (id <> 1)")
|
||||
}
|
||||
|
||||
func testFilterLiteralWithNamedArguments() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.filter(sql: "id <> :id", arguments: ["id": 1])),
|
||||
"SELECT * FROM \"readers\" WHERE id <> 1")
|
||||
"SELECT * FROM \"readers\" WHERE (id <> 1)")
|
||||
}
|
||||
|
||||
func testFilter() throws {
|
||||
@@ -316,21 +316,21 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.group(Col.name).having(sql: "min(age) > 18")),
|
||||
"SELECT * FROM \"readers\" GROUP BY \"name\" HAVING min(age) > 18")
|
||||
"SELECT * FROM \"readers\" GROUP BY \"name\" HAVING (min(age) > 18)")
|
||||
}
|
||||
|
||||
func testHavingLiteralWithPositionalArguments() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.group(Col.name).having(sql: "min(age) > ?", arguments: [18])),
|
||||
"SELECT * FROM \"readers\" GROUP BY \"name\" HAVING min(age) > 18")
|
||||
"SELECT * FROM \"readers\" GROUP BY \"name\" HAVING (min(age) > 18)")
|
||||
}
|
||||
|
||||
func testHavingLiteralWithNamedArguments() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.group(Col.name).having(sql: "min(age) > :age", arguments: ["age": 18])),
|
||||
"SELECT * FROM \"readers\" GROUP BY \"name\" HAVING min(age) > 18")
|
||||
"SELECT * FROM \"readers\" GROUP BY \"name\" HAVING (min(age) > 18)")
|
||||
}
|
||||
|
||||
func testHaving() throws {
|
||||
|
||||
@@ -166,21 +166,21 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.filter(sql: "id <> 1")),
|
||||
"SELECT * FROM \"readers\" WHERE id <> 1")
|
||||
"SELECT * FROM \"readers\" WHERE (id <> 1)")
|
||||
}
|
||||
|
||||
func testFilterLiteralWithPositionalArguments() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.filter(sql: "id <> ?", arguments: [1])),
|
||||
"SELECT * FROM \"readers\" WHERE id <> 1")
|
||||
"SELECT * FROM \"readers\" WHERE (id <> 1)")
|
||||
}
|
||||
|
||||
func testFilterLiteralWithNamedArguments() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.filter(sql: "id <> :id", arguments: ["id": 1])),
|
||||
"SELECT * FROM \"readers\" WHERE id <> 1")
|
||||
"SELECT * FROM \"readers\" WHERE (id <> 1)")
|
||||
}
|
||||
|
||||
func testFilter() throws {
|
||||
|
||||
Reference in new issue
Block a user