diff --git a/Tests/GRDBTests/SQLLiteralTests.swift b/Tests/GRDBTests/SQLLiteralTests.swift index b722c1728..81c2d7144 100644 --- a/Tests/GRDBTests/SQLLiteralTests.swift +++ b/Tests/GRDBTests/SQLLiteralTests.swift @@ -475,7 +475,8 @@ extension SQLLiteralTests { } do { - // Here we test that users can define functions that return literal expressions + // Here we test that users can define functions that return + // literal expressions. func date(_ value: SQLExpressible) -> SQLExpression { SQLLiteral("DATE(\(value))").sqlExpression } @@ -485,6 +486,20 @@ extension SQLLiteralTests { SELECT * FROM "player" WHERE (DATE("createdAt")) = '2020-01-23' """) } + + do { + // Here we test that users can still define functions that + // return literal expressions with the previously + // supported technique. + func date(_ value: SQLExpressible) -> SQLExpression { + SQLLiteral("DATE(\(value.sqlExpression))").sqlExpression + } + let createdAt = Column("createdAt") + let request = Player.filter(date(createdAt) == "2020-01-23") + try assertEqualSQL(db, request, """ + SELECT * FROM "player" WHERE (DATE("createdAt")) = '2020-01-23' + """) + } } } }