summaryrefslogtreecommitdiffstats
path: root/tests/test_parser.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-13 09:17:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-13 09:17:37 +0000
commit22342ec7693d09ebf96484be7c3cd5d8b506f38e (patch)
treeb8fe2ebfb290eb425dcee4f15fa8cab46e74b40f /tests/test_parser.py
parentAdding upstream version 18.3.0. (diff)
downloadsqlglot-22342ec7693d09ebf96484be7c3cd5d8b506f38e.tar.xz
sqlglot-22342ec7693d09ebf96484be7c3cd5d8b506f38e.zip
Adding upstream version 18.4.1.upstream/18.4.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_parser.py')
-rw-r--r--tests/test_parser.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 7135dd8..ad9b941 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -719,3 +719,18 @@ class TestParser(unittest.TestCase):
self.assertEqual(ast.find(exp.Interval).this.sql(), "'71'")
self.assertEqual(ast.find(exp.Interval).unit.assert_is(exp.Var).sql(), "days")
+
+ def test_parse_concat_ws(self):
+ ast = parse_one("CONCAT_WS(' ', 'John', 'Doe')")
+
+ self.assertEqual(ast.sql(), "CONCAT_WS(' ', 'John', 'Doe')")
+ self.assertEqual(ast.expressions[0].sql(), "' '")
+ self.assertEqual(ast.expressions[1].sql(), "'John'")
+ self.assertEqual(ast.expressions[2].sql(), "'Doe'")
+
+ # Ensure we can parse without argument when error level is ignore
+ ast = parse(
+ "CONCAT_WS()",
+ error_level=ErrorLevel.IGNORE,
+ )
+ self.assertEqual(ast[0].sql(), "CONCAT_WS()")