From fbaf4c2b596239e2ba2b88e36ac671672d94b1f3 Mon Sep 17 00:00:00 2001 From: Andi Albrecht Date: Sun, 14 Nov 2010 22:03:13 +0100 Subject: Match single line comments at end of string. The bug was reported for CrunchyFrog: http://code.google.com/p/crunchyfrog/issues/detail?id=88 --- tests/test_split.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/test_split.py b/tests/test_split.py index 50b3a6b..1995ca5 100644 --- a/tests/test_split.py +++ b/tests/test_split.py @@ -53,6 +53,16 @@ class SQLSplitTest(TestCaseBase): self.assertEqual(len(stmts), 3) self.ndiffAssertEqual(''.join(unicode(q) for q in stmts), sql) + def test_dashcomments_eol(self): + stmts = sqlparse.parse('select foo; -- comment\n') + self.assertEqual(len(stmts), 1) + stmts = sqlparse.parse('select foo; -- comment\r') + self.assertEqual(len(stmts), 1) + stmts = sqlparse.parse('select foo; -- comment\r\n') + self.assertEqual(len(stmts), 1) + stmts = sqlparse.parse('select foo; -- comment') + self.assertEqual(len(stmts), 1) + def test_begintag(self): sql = load_file('begintag.sql') stmts = sqlparse.parse(sql) -- cgit v1.2.1