From ca57dc468e5d8d0920e964d45ad25271ae6e633d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 24 Jul 2023 10:03:45 +0200 Subject: Adding upstream version 17.7.0. Signed-off-by: Daniel Baumann --- tests/test_transpile.py | 52 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) (limited to 'tests/test_transpile.py') diff --git a/tests/test_transpile.py b/tests/test_transpile.py index 1138b4e..3f284c9 100644 --- a/tests/test_transpile.py +++ b/tests/test_transpile.py @@ -186,7 +186,7 @@ WHERE */ SELECT tbl.cola /* comment 1 */ + tbl.colb /* comment 2 */, - CAST(x AS INT), # comment 3 + CAST(x AS CHAR), # comment 3 y -- comment 4 FROM bar /* comment 5 */, @@ -198,7 +198,7 @@ WHERE */ SELECT tbl.cola /* comment 1 */ + tbl.colb /* comment 2 */, - CAST(x AS INT), /* comment 3 */ + CAST(x AS CHAR), /* comment 3 */ y /* comment 4 */ FROM bar /* comment 5 */, tbl /* comment 6 */""", read="mysql", @@ -211,9 +211,12 @@ FROM bar /* comment 5 */, tbl /* comment 6 */""", -- comment 1 AND bar -- comment 2 - AND bla; + AND bla + -- comment 3 + LIMIT 10 + ; """, - "SELECT a FROM b WHERE foo AND /* comment 1 */ bar AND /* comment 2 */ bla", + "SELECT a FROM b WHERE foo AND /* comment 1 */ bar AND /* comment 2 */ bla LIMIT 10 /* comment 3 */", ) self.validate( """ @@ -285,6 +288,47 @@ FROM v""", "SELECT 1 /* hi this is a comment */", read="snowflake", ) + self.validate( + "-- comment\nDROP TABLE IF EXISTS foo", + "/* comment */ DROP TABLE IF EXISTS foo", + ) + self.validate( + """ + -- comment1 + -- comment2 + + -- comment3 + DROP TABLE IF EXISTS db.tba + """, + """/* comment1 */ +/* comment2 */ +/* comment3 */ +DROP TABLE IF EXISTS db.tba""", + pretty=True, + ) + self.validate( + """ + CREATE TABLE db.tba AS + SELECT a, b, c + FROM tb_01 + WHERE + -- comment5 + a = 1 AND b = 2 --comment6 + -- and c = 1 + -- comment7 + """, + """CREATE TABLE db.tba AS +SELECT + a, + b, + c +FROM tb_01 +WHERE + a /* comment5 */ = 1 AND b = 2 /* comment6 */ + /* and c = 1 */ + /* comment7 */""", + pretty=True, + ) def test_types(self): self.validate("INT 1", "CAST(1 AS INT)") -- cgit v1.2.3