This commit is contained in:
Gwendal Roué committed 2019-08-11 12:56:29 +02:00
1 parent 24c25dfd04
commit d28847bf3d
2 files changed
+19

No files matched your search

@@ -104,6 +104,16 @@ class SQLInterpolationTests: GRDBTestCase {
test(value: V(), isInterpolatedAs: "V".databaseValue)
}
func testDataInterpolation() {
// This test makes sure the Sequence conformance of Data does not
// kick in.
let data = "SQLite".data(using: .utf8)!
var sql = SQLInterpolation(literalCapacity: 0, interpolationCount: 1)
sql.appendInterpolation(data)
XCTAssertEqual(sql.sql, "?")
XCTAssertEqual(sql.arguments, [data])
}
func testQualifiedExpressionInterpolation() {
var sql = SQLInterpolation(literalCapacity: 0, interpolationCount: 1)
+9
View File
@@ -234,6 +234,15 @@ extension SQLLiteralTests {
test(value: V(), isInterpolatedAs: "V".databaseValue)
}
func testDataInterpolation() {
// This test makes sure the Sequence conformance of Data does not
// kick in.
let data = "SQLite".data(using: .utf8)!
let query: SQLLiteral = "SELECT \(data)"
XCTAssertEqual(query.sql, "SELECT ?")
XCTAssertEqual(query.arguments, [data])
}
func testQualifiedExpressionInterpolation() {
let query: SQLLiteral = """
SELECT \(Column("name").aliased("foo"))