branch: externals/sql-indent
commit e249b70ddc94a193ca80434ae36057fc205d20b2
Author: Alex Harsanyi <[email protected]>
Commit: Alex Harsanyi <[email protected]>
Update test for issue #19 to be more comprehensive
---
test-data/pr19-syn.eld | 164 ++++++++++++++++++-------------------------------
test-data/pr19.sql | 60 ++++++------------
2 files changed, 77 insertions(+), 147 deletions(-)
diff --git a/test-data/pr19-syn.eld b/test-data/pr19-syn.eld
index b84803d..8939a77 100644
--- a/test-data/pr19-syn.eld
+++ b/test-data/pr19-syn.eld
@@ -1,139 +1,93 @@
(((toplevel . 1))
- ((declare-statement . 1))
- ((statement-continuation . 11))
- ((select-clause . 30)
- (statement-continuation . 11))
- ((select-clause . 30)
- (statement-continuation . 11))
- (((in-select-clause "where")
- . 68)
- (statement-continuation . 11))
- ((declare-statement . 1))
- ((declare-statement . 1))
- ((declare-statement . 1))
- ((declare-statement . 1))
- (((defun-start "get_my_value")
- . 149))
- (((defun-start "get_my_value")
- . 149))
- (((defun-start "get_my_value")
- . 149))
- ((statement-continuation . 241))
- ((select-clause . 297)
- (statement-continuation . 241))
- ((select-clause . 297)
- (statement-continuation . 241))
- (((defun-start "get_my_value")
- . 149))
- (((defun-start "get_my_value")
- . 149))
- (((block-start begin)
- . 149)
- ((defun-start "get_my_value")
- . 149))
- (((in-begin-block defun "get_my_value")
- . 403))
- (((in-block loop "")
- . 413))
- (((block-end loop "")
- . 413)
- ((in-block loop "")
- . 413))
- (((block-end defun "get_my_value")
- . 403)
- ((in-begin-block defun "get_my_value")
- . 403))
- ((declare-statement . 1))
- (((block-start begin)
- . 1)
- (declare-statement . 1))
- (((in-begin-block toplevel-block "")
- . 509))
- (((in-block loop "")
- . 517))
- (((block-end loop "")
- . 517)
- ((in-block loop "")
- . 517))
- (((block-end toplevel-block "")
- . 509)
- ((in-begin-block toplevel-block "")
- . 509))
- ((toplevel . 1))
- ((toplevel . 1))
- ((toplevel . 1))
(((package-body "my_pacakge")
- . 595))
+ . 1))
(((package-body "my_pacakge")
- . 595))
- ((statement-continuation . 661))
- ((select-clause . 678)
- (statement-continuation . 661))
- ((select-clause . 678)
- (statement-continuation . 661))
+ . 1))
+ ((statement-continuation . 67))
+ ((select-clause . 84)
+ (statement-continuation . 67))
+ ((select-clause . 84)
+ (statement-continuation . 67))
(((in-select-clause "where")
- . 714)
- (statement-continuation . 661))
+ . 122)
+ (statement-continuation . 67))
(((package-body "my_pacakge")
- . 595))
+ . 1))
(((package-body "my_pacakge")
- . 595))
+ . 1))
(((package-body "my_pacakge")
- . 595))
+ . 1))
(((package-body "my_pacakge")
- . 595))
+ . 1))
(((defun-start "get_my_value")
- . 785))
+ . 198))
(((defun-start "get_my_value")
- . 785))
+ . 198))
(((defun-start "get_my_value")
- . 785))
- ((statement-continuation . 873))
- ((select-clause . 927)
- (statement-continuation . 873))
- ((select-clause . 927)
- (statement-continuation . 873))
+ . 198))
+ ((statement-continuation . 286))
+ ((select-clause . 340)
+ (statement-continuation . 286))
+ ((select-clause . 340)
+ (statement-continuation . 286))
(((defun-start "get_my_value")
- . 785))
+ . 198))
(((defun-start "get_my_value")
- . 785))
+ . 198))
(((block-start begin)
- . 785)
+ . 198)
((defun-start "get_my_value")
- . 785))
+ . 198))
(((in-begin-block defun "get_my_value")
- . 1024))
+ . 437))
(((in-block loop "")
- . 1032))
+ . 445))
(((block-end loop "")
- . 1032)
+ . 445)
((in-block loop "")
- . 1032))
+ . 445))
(((block-end defun "get_my_value")
- . 1024)
+ . 437)
((in-begin-block defun "get_my_value")
- . 1024))
+ . 437))
(((package-body "my_pacakge")
- . 595))
+ . 1))
(((block-start begin)
- . 595)
+ . 1)
((package-body "my_pacakge")
- . 595))
+ . 1))
(((in-begin-block package "my_pacakge")
- . 1120))
+ . 533))
(((in-block loop "")
- . 1128))
+ . 541))
(((block-end loop "")
- . 1128)
+ . 541)
((in-block loop "")
- . 1128))
+ . 541))
+ (((in-begin-block package "my_pacakge")
+ . 533))
+ (((in-begin-block package "my_pacakge")
+ . 533))
+ (((in-begin-block nil "")
+ . 614))
+ (((block-end nil "")
+ . 614)
+ ((in-begin-block nil "")
+ . 614))
(((in-begin-block package "my_pacakge")
- . 1120))
+ . 533))
(((in-begin-block package "my_pacakge")
- . 1120))
+ . 533))
(((block-end package "my_pacakge")
- . 1120)
+ . 533)
((in-begin-block package "my_pacakge")
- . 1120))
+ . 533))
((toplevel . 1))
+ ((comment-start . 1)
+ (toplevel . 1))
+ ((comment-start . 1)
+ (toplevel . 1))
+ ((comment-start . 1)
+ (toplevel . 1))
((toplevel . 1)))
+
diff --git a/test-data/pr19.sql b/test-data/pr19.sql
index 3f21314..35e54da 100644
--- a/test-data/pr19.sql
+++ b/test-data/pr19.sql
@@ -1,64 +1,40 @@
-declare
- cursor cur1 is
- select dummy
- from my_table
- where 1 = 1
- and col1 = p_col1;
+create or replace package body my_pacakge authid current user is
+ cursor cur1 is
+ select 1 dummy
+ from my_table
+ where 1 = 1
+ and col1 = p_col1;
+
p_col1 my_table.col1%type := 42;
-
+
function get_my_value(p_param1 in my_table.col1%type)
return my_table.col2%type is
cursor cur2 (p_val_col1 in my_table.col1%type) is
select col2
- from my_table
- where col1 = p_val_col1;
-
+ from my_table
+ where col1 = p_val_col1;
+
v_result my_table.col2%type;
begin
for rec in cur2(p_param1) loop
v_result := rec.col2;
end loop;
end get_my_value;
-
+
begin
for rec in cur1 loop
dbms_output.put_line(rec.dummy);
end loop;
-end;
-/
-
-create or replace package body my_pacakge authid current user is
-cursor cur1 is
- select 1 dummy
- from my_table
- where 1 = 1
- and col1 = p_col1;
-
-p_col1 my_table.col1%type := 42;
-
-function get_my_value(p_param1 in my_table.col1%type)
- return my_table.col2%type is
-
- cursor cur2 (p_val_col1 in my_table.col1%type) is
- select col2
- from my_table
- where col1 = p_val_col1;
-
- v_result my_table.col2%type;
-begin
- for rec in cur2(p_param1) loop
- v_result := rec.col2;
- end loop;
-end get_my_value;
+ begin
+ null;
+ end;
-begin
- for rec in cur1 loop
- dbms_output.put_line(rec.dummy);
- end loop;
-
dbms_output.put_line(get_my_value(p_col1));
end my_pacakge;
/
+-- Local Variables:
+-- sql-product: oracle
+-- End: