1
0
Fork 0

Adding upstream version 17.12.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 20:54:58 +01:00
parent 276276930e
commit 9de781a59b
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
64 changed files with 12465 additions and 11885 deletions

View file

@ -90,6 +90,19 @@ class TestTranspile(unittest.TestCase):
self.validate("SELECT 3>=3", "SELECT 3 >= 3")
def test_comments(self):
self.validate("SELECT\n foo\n/* comments */\n;", "SELECT foo /* comments */")
self.validate(
"SELECT * FROM a INNER /* comments */ JOIN b",
"SELECT * FROM a /* comments */ INNER JOIN b",
)
self.validate(
"SELECT * FROM a LEFT /* comment 1 */ OUTER /* comment 2 */ JOIN b",
"SELECT * FROM a /* comment 1 */ /* comment 2 */ LEFT OUTER JOIN b",
)
self.validate(
"SELECT CASE /* test */ WHEN a THEN b ELSE c END",
"SELECT CASE WHEN a THEN b ELSE c END /* test */",
)
self.validate("SELECT 1 /*/2 */", "SELECT 1 /* /2 */")
self.validate("SELECT */*comment*/", "SELECT * /* comment */")
self.validate(
@ -308,6 +321,7 @@ DROP TABLE IF EXISTS db.tba""",
)
self.validate(
"""
-- comment4
CREATE TABLE db.tba AS
SELECT a, b, c
FROM tb_01
@ -316,8 +330,10 @@ DROP TABLE IF EXISTS db.tba""",
a = 1 AND b = 2 --comment6
-- and c = 1
-- comment7
;
""",
"""CREATE TABLE db.tba AS
"""/* comment4 */
CREATE TABLE db.tba AS
SELECT
a,
b,
@ -329,6 +345,44 @@ WHERE
/* comment7 */""",
pretty=True,
)
self.validate(
"""
SELECT
-- This is testing comments
col,
-- 2nd testing comments
CASE WHEN a THEN b ELSE c END as d
FROM t
""",
"""SELECT
col, /* This is testing comments */
CASE WHEN a THEN b ELSE c END /* 2nd testing comments */ AS d
FROM t""",
pretty=True,
)
self.validate(
"""
SELECT * FROM a
-- comments
INNER JOIN b
""",
"""SELECT
*
FROM a
/* comments */
INNER JOIN b""",
pretty=True,
)
self.validate(
"SELECT * FROM a LEFT /* comment 1 */ OUTER /* comment 2 */ JOIN b",
"""SELECT
*
FROM a
/* comment 1 */
/* comment 2 */
LEFT OUTER JOIN b""",
pretty=True,
)
def test_types(self):
self.validate("INT 1", "CAST(1 AS INT)")