diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-24 08:03:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-24 08:03:45 +0000 |
commit | ca57dc468e5d8d0920e964d45ad25271ae6e633d (patch) | |
tree | 319d8bffcb5c3e9afe9e62beca9ef401480578d2 /tests/test_transpile.py | |
parent | Adding upstream version 17.4.1. (diff) | |
download | sqlglot-ca57dc468e5d8d0920e964d45ad25271ae6e633d.tar.xz sqlglot-ca57dc468e5d8d0920e964d45ad25271ae6e633d.zip |
Adding upstream version 17.7.0.upstream/17.7.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/test_transpile.py | 52 |
1 files changed, 48 insertions, 4 deletions
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)") |