summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2011-07-24 00:37:47 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2011-07-24 00:37:47 +0200
commit693d7a31c1fff960763ff3ba485142ce67ff708f (patch)
tree683cd31a2bf67fe212d9f1dc145ddd39eb3a50ee /tests
parent0e1cb7ac237cedeac30d26c2ccaa2ea34395b643 (diff)
downloadsqlparse-693d7a31c1fff960763ff3ba485142ce67ff708f.tar.gz
Split statements with IF as functions correctly (fixes issue33).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_split.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_split.py b/tests/test_split.py
index 1995ca5..a794b76 100644
--- a/tests/test_split.py
+++ b/tests/test_split.py
@@ -103,3 +103,10 @@ class SQLSplitTest(TestCaseBase):
'SELECT 2;')
stmts = sqlparse.split(sql)
self.assertEqual(len(stmts), 2)
+
+ def test_if_function(self): # see issue 33
+ # don't let IF as a function confuse the splitter
+ sql = ('CREATE TEMPORARY TABLE tmp SELECT IF(a=1, a, b) AS o FROM one; '
+ 'SELECT t FROM two')
+ stmts = sqlparse.split(sql)
+ self.assertEqual(len(stmts), 2)