Skip to content

Commit 900fc77

Browse files
committed
Enable path forc loop test
Now that the upstream parse errors in libpg_query have been fixed we can enable the test.
1 parent 015a854 commit 900fc77

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

tests/plpgsql_path_loop_test.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,22 @@ def test_dynfors_loop():
107107
assert str(pathes[0]) == "PLpgSQL_stmt_raise(6) -> PLpgSQL_stmt_return()"
108108

109109

110-
# def test_forc_loop():
111-
# sql = """
112-
# CREATE FUNCTION foo(cmd TEXT) RETURNS void AS $$
113-
# DECLARE
114-
# i INT;
115-
# c CURSOR FOR SELECT generate_series(1,10);
116-
# BEGIN
117-
# FOR i IN c LOOP
118-
# RAISE NOTICE 'i is %',i;
119-
# END LOOP;
120-
# END
121-
# $$ LANGUAGE plpgsql;
122-
# """
123-
# parsed = parse_plpgsql(sql)
124-
# node = build_node(parsed[0])
125-
# pathes = list(paths(node))
126-
# assert len(pathes) == 1
127-
#
128-
# assert str(pathes[0]) == "PLpgSQL_stmt_raise(6) -> PLpgSQL_stmt_return()"
110+
def test_forc_loop():
111+
sql = """
112+
CREATE FUNCTION foo(cmd TEXT) RETURNS void AS $$
113+
DECLARE
114+
i INT;
115+
c CURSOR FOR SELECT generate_series(1,10);
116+
BEGIN
117+
FOR i IN c LOOP
118+
RAISE NOTICE 'i is %',i;
119+
END LOOP;
120+
END
121+
$$ LANGUAGE plpgsql;
122+
"""
123+
parsed = parse_plpgsql(sql)
124+
node = build_node(parsed[0])
125+
pathes = list(paths(node))
126+
assert len(pathes) == 1
127+
128+
assert str(pathes[0]) == "PLpgSQL_stmt_raise(7) -> PLpgSQL_stmt_return()"

0 commit comments

Comments
 (0)