diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2015-07-28 20:24:06 +0200 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2015-07-28 20:24:06 +0200 |
| commit | 5d71c27e5194dfc8b8869f3170803e1d18bad6dc (patch) | |
| tree | 944522019decb4e54067efec4b2ec3c77ee8134b /tests | |
| parent | 8987a3a6b540ea35bbb1f9c5f49f3306501289cd (diff) | |
| download | sqlparse-5d71c27e5194dfc8b8869f3170803e1d18bad6dc.tar.gz | |
Handle END IF correctly when splitting statements (fixes #194).
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_regressions.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_regressions.py b/tests/test_regressions.py index ea8cd56..a64b400 100644 --- a/tests/test_regressions.py +++ b/tests/test_regressions.py @@ -256,6 +256,19 @@ SELECT * FROM a.b;""" splitted = sqlparse.split(sql) assert len(splitted) == 2 +def test_issue194_splitting_function(): + sql = """CREATE FUNCTION a(x VARCHAR(20)) RETURNS VARCHAR(20) +BEGIN + DECLARE y VARCHAR(20); + IF (1 = 1) THEN + SET x = y; + END IF; + RETURN x; +END; +SELECT * FROM a.b;""" + splitted = sqlparse.split(sql) + assert len(splitted) == 2 + def test_issue186_get_type(): sql = "-- comment\ninsert into foo" |
