mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
Add two safety tests for parenthesis
This commit is contained in:
1 parent
4729405625
commit
b0e140d4bb
2 files changed
+6
-2
No files matched your search
@@ -59,6 +59,7 @@ class SQLInterpolationTests: GRDBTestCase {
|
||||
let nilInteger: Int? = nil
|
||||
sql.appendInterpolation(a); sql.appendLiteral("\n")
|
||||
sql.appendInterpolation(a + 1); sql.appendLiteral("\n")
|
||||
sql.appendInterpolation(2 * (a + 1)); sql.appendLiteral("\n")
|
||||
sql.appendInterpolation(a < b); sql.appendLiteral("\n")
|
||||
sql.appendInterpolation(integer); sql.appendLiteral("\n")
|
||||
sql.appendInterpolation(optionalInteger); sql.appendLiteral("\n")
|
||||
@@ -68,13 +69,14 @@ class SQLInterpolationTests: GRDBTestCase {
|
||||
XCTAssertEqual(sql.sql, """
|
||||
"a"
|
||||
"a" + ?
|
||||
? * ("a" + ?)
|
||||
"a" < "b"
|
||||
?
|
||||
?
|
||||
NULL
|
||||
"a" IS NULL
|
||||
""")
|
||||
XCTAssertEqual(sql.arguments, [1, 1, 2])
|
||||
XCTAssertEqual(sql.arguments, [1, 2, 1, 1, 2])
|
||||
}
|
||||
|
||||
func testQualifiedExpressionInterpolation() {
|
||||
|
||||
@@ -189,6 +189,7 @@ extension SQLLiteralTests {
|
||||
SELECT
|
||||
\(a),
|
||||
\(a + 1),
|
||||
\(2 * (a + 1)),
|
||||
\(a < b),
|
||||
\(integer),
|
||||
\(optionalInteger),
|
||||
@@ -199,13 +200,14 @@ extension SQLLiteralTests {
|
||||
SELECT
|
||||
"a",
|
||||
"a" + ?,
|
||||
? * ("a" + ?),
|
||||
"a" < "b",
|
||||
?,
|
||||
?,
|
||||
NULL,
|
||||
"a" IS NULL
|
||||
""")
|
||||
XCTAssertEqual(query.arguments, [1, 1, 2])
|
||||
XCTAssertEqual(query.arguments, [1, 2, 1, 1, 2])
|
||||
}
|
||||
|
||||
func testQualifiedExpressionInterpolation() {
|
||||
|
||||
Reference in new issue
Block a user