summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorcasey <casey@cloudera.com>2015-02-26 12:32:46 -0800
committercasey <casey@cloudera.com>2015-02-26 12:32:46 -0800
commite75e35869473832a1eb67772b1adfee2db11b85a (patch)
treead6003130092f9fac951ba29740162cb6931a6d9 /tests
parent77e0789aea8918a2fbbc6f20196cd0bcdecccf52 (diff)
downloadsqlparse-e75e35869473832a1eb67772b1adfee2db11b85a.tar.gz
Recognize escaped backslashes within strings
Previously if a single quoted string ended with an escaped backslash, parsing would not consider the string to be terminated.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_split.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/test_split.py b/tests/test_split.py
index e4ebf7e..54e8d04 100644
--- a/tests/test_split.py
+++ b/tests/test_split.py
@@ -22,6 +22,10 @@ class SQLSplitTest(TestCaseBase):
self.ndiffAssertEqual(unicode(stmts[0]), self._sql1)
self.ndiffAssertEqual(unicode(stmts[1]), sql2)
+ def test_split_backslash(self):
+ stmts = sqlparse.parse(r"select '\\'; select '\''; select '\\\'';")
+ self.assertEqual(len(stmts), 3)
+
def test_create_function(self):
sql = load_file('function.sql')
stmts = sqlparse.parse(sql)