From d28847bf3d9cdf32df2699fc47778e032b904d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 11 Aug 2019 12:56:29 +0200 Subject: [PATCH] Failing test for https://github.com/groue/GRDB.swift/issues/591 --- Tests/GRDBTests/SQLInterpolationTests.swift | 10 ++++++++++ Tests/GRDBTests/SQLLiteralTests.swift | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/Tests/GRDBTests/SQLInterpolationTests.swift b/Tests/GRDBTests/SQLInterpolationTests.swift index bce0ba8e2..100a1f555 100644 --- a/Tests/GRDBTests/SQLInterpolationTests.swift +++ b/Tests/GRDBTests/SQLInterpolationTests.swift @@ -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) diff --git a/Tests/GRDBTests/SQLLiteralTests.swift b/Tests/GRDBTests/SQLLiteralTests.swift index a649545c4..bae20c007 100644 --- a/Tests/GRDBTests/SQLLiteralTests.swift +++ b/Tests/GRDBTests/SQLLiteralTests.swift @@ -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"))