summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/files/slashcomment.sql5
-rw-r--r--tests/test_split.py16
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/files/slashcomment.sql b/tests/files/slashcomment.sql
new file mode 100644
index 0000000..90e3089
--- /dev/null
+++ b/tests/files/slashcomment.sql
@@ -0,0 +1,5 @@
+select * from user;
+//select * from host;
+select * from user;
+select * // foo;
+from foo;
diff --git a/tests/test_split.py b/tests/test_split.py
index a93e3d4..ccb84a8 100644
--- a/tests/test_split.py
+++ b/tests/test_split.py
@@ -52,6 +52,22 @@ def test_split_dashcomments_eol(s):
assert len(stmts) == 1
+def test_split_slashcomments(load_file):
+ sql = load_file('slashcomment.sql')
+ stmts = sqlparse.parse(sql)
+ assert len(stmts) == 3
+ assert ''.join(str(q) for q in stmts) == sql
+
+
+@pytest.mark.parametrize('s', ['select foo; // comment\n',
+ 'select foo; // comment\r',
+ 'select foo; // comment\r\n',
+ 'select foo; // comment'])
+def test_split_slashcomments_eol(s):
+ stmts = sqlparse.parse(s)
+ assert len(stmts) == 1
+
+
def test_split_begintag(load_file):
sql = load_file('begintag.sql')
stmts = sqlparse.parse(sql)