diff options
| author | Fredy Wijaya <fredy.wijaya@gmail.com> | 2018-11-21 18:05:53 -0600 |
|---|---|---|
| committer | Fredy Wijaya <fredy.wijaya@gmail.com> | 2018-11-21 18:11:28 -0600 |
| commit | 6c7b89cc8ddbe3159befb4616b70384bf491a29e (patch) | |
| tree | 0f849547abe102874d01362eed354625732f9a69 /tests | |
| parent | 488505f6c448e7eb0e4a1915bdc5b6130d44a68a (diff) | |
| download | sqlparse-6c7b89cc8ddbe3159befb4616b70384bf491a29e.tar.gz | |
Fix issue with strip_comments causing a syntax error (fixes #425)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_format.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_format.py b/tests/test_format.py index 72af62e..aff07c1 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -50,6 +50,19 @@ class TestFormat(object): sql = 'select-- foo\nfrom -- bar\nwhere' res = sqlparse.format(sql, strip_comments=True) assert res == 'select from where' + sql = 'select *-- statement starts here\n\nfrom foo' + res = sqlparse.format(sql, strip_comments=True) + assert res == 'select * from foo' + sql = 'select * from foo-- statement starts here\nwhere' + res = sqlparse.format(sql, strip_comments=True) + assert res == 'select * from foo where' + sql = 'select a-- statement starts here\nfrom foo' + res = sqlparse.format(sql, strip_comments=True) + assert res == 'select a from foo' + sql = '--comment\nselect a-- statement starts here\n' \ + 'from foo--comment\nf' + res = sqlparse.format(sql, strip_comments=True) + assert res == 'select a from foo f' def test_strip_comments_invalid_option(self): sql = 'select-- foo\nfrom -- bar\nwhere' |
