summaryrefslogtreecommitdiffstats
path: root/tests/test_transpile.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 02:50:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 02:50:21 +0000
commitda8fc943704a221b86f0f6938f4131f0dd679f82 (patch)
treebef7144499ea444319403ba8dbf68480ae3a4e39 /tests/test_transpile.py
parentAdding upstream version 23.10.0. (diff)
downloadsqlglot-da8fc943704a221b86f0f6938f4131f0dd679f82.tar.xz
sqlglot-da8fc943704a221b86f0f6938f4131f0dd679f82.zip
Adding upstream version 23.12.1.upstream/23.12.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_transpile.py')
-rw-r--r--tests/test_transpile.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_transpile.py b/tests/test_transpile.py
index 95fba30..22085b3 100644
--- a/tests/test_transpile.py
+++ b/tests/test_transpile.py
@@ -124,6 +124,10 @@ class TestTranspile(unittest.TestCase):
"SELECT * FROM t1 /* x */ UNION ALL SELECT * FROM t2",
)
self.validate(
+ "/* comment */ SELECT * FROM a UNION SELECT * FROM b",
+ "/* comment */ SELECT * FROM a UNION SELECT * FROM b",
+ )
+ self.validate(
"SELECT * FROM t1\n/*x*/\nINTERSECT ALL SELECT * FROM t2",
"SELECT * FROM t1 /* x */ INTERSECT ALL SELECT * FROM t2",
)
@@ -524,6 +528,28 @@ INNER JOIN y
USING (id)""",
pretty=True,
)
+ self.validate(
+ """with x as (
+ SELECT *
+ /*
+NOTE: LEFT JOIN because blah blah blah
+ */
+ FROM a
+)
+select * from x""",
+ """WITH x AS (
+ SELECT
+ *
+ /*
+NOTE: LEFT JOIN because blah blah blah
+ */
+ FROM a
+)
+SELECT
+ *
+FROM x""",
+ pretty=True,
+ )
def test_types(self):
self.validate("INT 1", "CAST(1 AS INT)")