branch: externals/sql-indent
commit 9b4a5a7e26bb7c543a96b7ce1f73f6dd5c5fb25f
Author: Alex Harsanyi <[email protected]>
Commit: Alex Harsanyi <[email protected]>

    Add a test suite for sql-indent
---
 sql-indent-test.el            | 212 +++++++++++++++++++++++++++++++++++++++++
 test-data/pr17-io-default.eld |   1 +
 test-data/pr17-io-left.eld    |   1 +
 test-data/pr17-io-right.eld   |   1 +
 test-data/pr17-syn.eld        | 215 ++++++++++++++++++++++++++++++++++++++++++
 test-data/pr17.sql            |  94 ++++++++++++++++++
 test-data/pr7-syn.eld         | 131 +++++++++++++++++++++++++
 test-data/pr7.eld             | 131 +++++++++++++++++++++++++
 test-data/pr7.sql             |  47 +++++++++
 9 files changed, 833 insertions(+)

diff --git a/sql-indent-test.el b/sql-indent-test.el
new file mode 100644
index 0000000..48ce7c4
--- /dev/null
+++ b/sql-indent-test.el
@@ -0,0 +1,212 @@
+;;; sql-indent-test.el --- Test utilities for sql-indent.el. -*- 
lexical-binding: t -*-
+;; Copyright (C) 2017 Alex Harsanyi
+;;
+;; Author: Alex Harsanyi ([email protected])
+;; Created: 23 May 2017
+;; Keywords: languages sql
+;; Homepage: https://github.com/alex-hhh/emacs-sql-indent
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2 of the License, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+;;; Commentary:
+
+;; To run the tests, eval this file and run
+;;
+;; M-x ert RET "^sqlind-" RET
+;;
+;; There are two types of tests,
+;;
+;; * syntax checks (see `sqlind-ert-check-file-syntax') check if the syntax in
+;;   an SQL file is correctly indentified.  These tests are independent of
+;;   indentation preferences
+;;
+;; * indentation checks (see `sqlind-ert-check-file-indentation') checks if a
+;;   file is indented corectly for a set of rules.
+;;
+;; The tests work by having a sample SQL file and syntax and indentation data
+;; saved in an .eld file.  These need to be prepared separately, but some
+;; helper functions are available, see the test data preparation section below
+
+(require 'ert)
+(require 'sql-indent)
+(require 'sql-indent-left)
+
+
+
+;;................................................ test data preparation ....
+
+;; The functions below help prepare the required .eld files for the tests.  To
+;; create a syntax check file, open an *ielm* buffer (M-x ielm RET) and run:
+;;
+;; (sqlind-collect-syntax-from-buffer (find-file-noselect "pr7.sql")))
+;;
+;; Than put the result in an .eld file
+;;
+;; To create an indentation offsets file, run:
+;;
+;; (sqlind-collect-indentation-offsets-from-buffer (find-file-noselect 
"pr7.sql") sqlind-indentation-left-offsets-alist 2))
+;;
+;; and put the result in an .eld file
+;;
+;; see the end of file on how to put together the actual tests.
+
+(defun sqlind-collect-syntax-from-buffer (buffer)
+  (let ((result '()))
+    (with-current-buffer buffer
+      (save-excursion
+        ;; NOTE: we indent the buffer according to the default rules first, as
+        ;; this affects anchor points.  We could get rid of this if we write a
+        ;; smarter `sqlind-ert-check-line-syntax'
+        (sqlind-ert-indent-buffer
+         (default-value 'sqlind-indentation-offsets-alist)
+         (default-value 'sqlind-basic-offset))
+        (goto-char (point-min))
+        (let ((syn (sqlind-syntax-of-line)))
+          (setq result (cons syn result)))
+        (while (= (forward-line 1) 0)
+          (let ((syn (sqlind-syntax-of-line)))
+            (setq result (cons syn result))))))
+    (reverse result)))
+
+(defun sqlind-collect-indentation-offsets-from-buffer (buffer rules 
basic-offset)
+  (let ((result '()))
+    (with-current-buffer buffer
+      (save-excursion
+        (sqlind-ert-indent-buffer
+         (or rules (default-value 'sqlind-indentation-offsets-alist))
+         (or basic-offset (default-value 'sqlind-basic-offset)))
+        (goto-char (point-min))
+        (setq result (cons (current-indentation) result))
+        (while (= (forward-line 1) 0)
+          (setq result (cons (current-indentation) result)))))
+    (reverse result)))
+
+
+;;......................................................... test helpers ....
+
+(defun sqlind-ert-indent-buffer (rules basic-offset)
+  "Indent the buffer according to RULES and BASIC-OFFSET.
+The RULES and BASIC-OFFSET are installed as
+`sqlind-indentation-offsets-alist' and `sqlind-basic-offset' than
+inddent the whole buffer."
+  (when rules
+    (setq sqlind-indentation-offsets-alist rules))
+  (when basic-offset
+    (setq sqlind-basic-offset basic-offset))
+  (indent-region (point-min) (point-max)))
+
+(defun sqlind-ert-check-line-syntax (expected)
+  "Check that the current line has EXPECTED syntax.
+Get the syntax of the current line in the current buffer using
+`sqlind-syntax-of-line' and compare it against EXPECTED. 
+
+ The comparison is done using the `should' ERT macro, so this
+function should be run a part of an ERT test."
+  (let ((actual (sqlind-syntax-of-line))
+        (info (format "%s:%s"
+                      (buffer-file-name)
+                      (line-number-at-pos))))
+    ;; NOTE: should does not appear to have a message argument, so the "cons"
+    ;; trick is used to add some information in case of failure.
+    (should
+     (equal (cons info actual) (cons info expected)))))
+
+(defun sqlind-ert-read-data (file)
+  "Read saved ELISP data from FILE."
+  (with-current-buffer (or (get-buffer file)
+                           (find-file-literally file))
+    (goto-char (point-min))
+    (read (current-buffer))))
+
+(defun sqlind-ert-check-file-syntax (sql-file data-file)
+  "Check the syntax of each line in SQL-FILE.
+The syntax of each line in SQL-FILE is checked against the
+previously saved syntax data in DATA-FILE.  An error is signaled
+if there is a mismatch."
+  (let ((syntax-data (sqlind-ert-read-data data-file)))
+    (with-current-buffer (find-file sql-file)
+      (save-excursion
+        ;; NOTE: indent the buffer according to default rules first -- this
+        ;; affects anchor points.
+        (sqlind-ert-indent-buffer
+         (default-value 'sqlind-indentation-offsets-alist)
+         (default-value 'sqlind-basic-offset))
+        (goto-char (point-min))
+        (should (consp syntax-data))    ; "premature end of syntax-data"
+        (sqlind-ert-check-line-syntax (car syntax-data))
+        (setq syntax-data (cdr syntax-data))
+        (while (= (forward-line 1) 0)
+          (should (consp syntax-data))  ; "premature end of syntax-data"
+          (sqlind-ert-check-line-syntax (car syntax-data))
+          (setq syntax-data (cdr syntax-data)))))))
+
+(defun sqlind-ert-check-line-indentation (expected)
+  "Check that the current line has EXPECTED indentation.
+The comparison is done using the `should' ERT macro, so this
+function should be run a part of an ERT test."
+  (let ((actual (current-indentation))
+        (info (format "%s:%s"
+                      (buffer-file-name)
+                      (line-number-at-pos))))
+    ;; NOTE: should does not appear to have a message argument, so the "cons"
+    ;; trick is used to add some information in case of failure.
+    (should
+     (equal (cons info actual) (cons info expected)))))
+
+(defun sqlind-ert-check-file-indentation (sql-file data-file rules 
basic-offset)
+  "Check that SQL-FILE is indented correctly according to RULES
+and BASIC-OFFSET The file is indented first according to RULES
+and BASIC-OFFSET, than each line is compared with the indentation
+information read from DATA-FILE (as generated by
+`sqlind-collect-indentation-offsets-from-buffer')"
+  (let ((indentation-data (sqlind-ert-read-data data-file)))
+    (with-current-buffer (find-file sql-file)
+      (sqlind-ert-indent-buffer rules basic-offset)
+      (goto-char (point-min))
+      (should (consp indentation-data))    ; "premature end of indentation-data
+      (sqlind-ert-check-line-indentation (car indentation-data))
+      (setq indentation-data (cdr indentation-data))
+      (while (= (forward-line 1) 0)
+        (should (consp indentation-data))  ; "premature end of syntax-data"
+        (sqlind-ert-check-line-indentation (car indentation-data))
+        (setq indentation-data (cdr indentation-data))))))
+
+
+;;..................................................... the actual tests ....
+
+(ert-deftest sqlind-ert-pr17 ()
+  (sqlind-ert-check-file-syntax "test-data/pr17.sql" "test-data/pr17-syn.eld"))
+
+(ert-deftest sqlind-ert-pr17-indentation-default ()
+  (sqlind-ert-check-file-indentation
+   "test-data/pr17.sql" "test-data/pr17-io-default.eld"
+   (default-value 'sqlind-indentation-offsets-alist)
+   (default-value 'sqlind-basic-offset)))
+
+(ert-deftest sqlind-ert-pr17-indentation-left ()
+  (sqlind-ert-check-file-indentation
+   "test-data/pr17.sql" "test-data/pr17-io-left.eld"
+   sqlind-indentation-left-offsets-alist
+   (default-value 'sqlind-basic-offset)))
+
+(ert-deftest sqlind-ert-pr17-indentation-right ()
+  (sqlind-ert-check-file-indentation
+   "test-data/pr17.sql" "test-data/pr17-io-right.eld"
+   sqlind-indentation-right-offsets-alist
+   (default-value 'sqlind-basic-offset)))
+
+(ert-deftest sqlind-ert-pr7 ()
+  (sqlind-ert-check-file-syntax "test-data/pr7.sql" "test-data/pr7-syn.eld"))
+
diff --git a/test-data/pr17-io-default.eld b/test-data/pr17-io-default.eld
new file mode 100644
index 0000000..78f87b1
--- /dev/null
+++ b/test-data/pr17-io-default.eld
@@ -0,0 +1 @@
+(0 0 0 0 0 0 0 0 9 9 9 7 9 2 1 8 4 0 0 7 7 7 7 7 7 2 9 1 4 4 4 4 4 4 25 32 24 
27 27 27 27 27 8 0 0 1 8 15 8 8 0 0 3 10 1 7 13 7 7 0 0 12 12 12 0 7 7 7 7 7 7 
24 7 24 7 2 31 31 51 51 26 10 10 29 24 10 1 10 1 10 10 0 0 0 0)
diff --git a/test-data/pr17-io-left.eld b/test-data/pr17-io-left.eld
new file mode 100644
index 0000000..75b166e
--- /dev/null
+++ b/test-data/pr17-io-left.eld
@@ -0,0 +1 @@
+(0 0 0 0 0 0 0 0 10 10 10 7 4 0 0 12 0 0 0 7 7 7 7 7 7 0 7 0 0 0 0 0 0 0 19 26 
19 19 19 19 19 19 0 0 0 0 0 8 0 0 0 0 0 7 0 0 7 0 0 0 0 12 14 14 0 7 7 7 7 7 7 
25 7 25 7 0 29 29 50 50 22 7 8 27 20 8 0 9 0 9 0 0 0 0 0)
diff --git a/test-data/pr17-io-right.eld b/test-data/pr17-io-right.eld
new file mode 100644
index 0000000..9a16743
--- /dev/null
+++ b/test-data/pr17-io-right.eld
@@ -0,0 +1 @@
+(0 0 0 0 0 0 0 0 10 10 10 7 4 2 1 13 4 0 0 7 7 7 7 7 7 2 9 1 4 4 4 4 4 4 25 32 
24 27 27 27 27 27 1 0 0 1 4 11 4 1 0 0 3 10 1 3 9 3 1 0 0 12 12 12 0 7 7 7 7 7 
7 24 7 24 7 2 31 31 51 51 26 10 10 29 24 10 1 10 1 10 1 0 0 0 0)
\ No newline at end of file
diff --git a/test-data/pr17-syn.eld b/test-data/pr17-syn.eld
new file mode 100644
index 0000000..9d34a47
--- /dev/null
+++ b/test-data/pr17-syn.eld
@@ -0,0 +1,215 @@
+(((toplevel . 1))
+ ((toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((toplevel . 1))
+ ((toplevel . 1))
+ ((toplevel . 1))
+ ((toplevel . 1))
+ ((select-column-continuation . 99)
+  (statement-continuation . 99))
+ ((select-column-continuation . 99)
+  (statement-continuation . 99))
+ ((select-column-continuation . 99)
+  (statement-continuation . 99))
+ ((select-column . 99)
+  (statement-continuation . 99))
+ ((select-column-continuation . 99)
+  (statement-continuation . 99))
+ ((select-clause . 99)
+  (statement-continuation . 99))
+ ((select-clause . 99)
+  (statement-continuation . 99))
+ (((in-select-clause "where")
+   . 306)
+  (statement-continuation . 99))
+ (((in-select-clause "where")
+   . 306)
+  (statement-continuation . 99))
+ ((toplevel . 1))
+ ((toplevel . 1))
+ ((select-column . 375)
+  (statement-continuation . 375))
+ ((select-column . 375)
+  (statement-continuation . 375))
+ ((select-column . 375)
+  (statement-continuation . 375))
+ ((select-column . 375)
+  (statement-continuation . 375))
+ ((select-column . 375)
+  (statement-continuation . 375))
+ ((select-column . 375)
+  (statement-continuation . 375))
+ ((select-clause . 375)
+  (statement-continuation . 375))
+ ((select-table . 565)
+  (statement-continuation . 375))
+ ((select-clause . 375)
+  (statement-continuation . 375))
+ (((in-select-clause "where")
+   . 624)
+  (statement-continuation . 375))
+ (((in-select-clause "where")
+   . 624)
+  (statement-continuation . 375))
+ (((in-select-clause "where")
+   . 624)
+  (statement-continuation . 375))
+ (((in-select-clause "where")
+   . 624)
+  (statement-continuation . 375))
+ (((in-select-clause "where")
+   . 624)
+  (statement-continuation . 375))
+ (((in-select-clause "where")
+   . 624)
+  (statement-continuation . 375))
+ ((select-clause . 888)
+  (nested-statement-continuation . 887)
+  (statement-continuation . 887))
+ ((select-table . 922)
+  (nested-statement-continuation . 887)
+  (statement-continuation . 887))
+ ((select-clause . 888)
+  (nested-statement-continuation . 887)
+  (statement-continuation . 887))
+ (((in-select-clause "where")
+   . 1029)
+  (nested-statement-continuation . 887)
+  (statement-continuation . 887))
+ (((in-select-clause "where")
+   . 1029)
+  (nested-statement-continuation . 887)
+  (statement-continuation . 887))
+ (((in-select-clause "where")
+   . 1029)
+  (nested-statement-continuation . 887)
+  (statement-continuation . 887))
+ (((in-select-clause "where")
+   . 1029)
+  (nested-statement-continuation . 887)
+  (statement-continuation . 887))
+ (((in-select-clause "where")
+   . 1029)
+  (nested-statement-continuation . 887)
+  (statement-continuation . 887))
+ (((in-select-clause "where")
+   . 624)
+  (statement-continuation . 375))
+ ((toplevel . 1))
+ ((toplevel . 1))
+ ((delete-clause . 1417)
+  (statement-continuation . 1417))
+ (((in-delete-clause "where")
+   . 1442)
+  (statement-continuation . 1417))
+ ((nested-statement-continuation . 1481)
+  (statement-continuation . 1481))
+ (((in-delete-clause "where")
+   . 1442)
+  (statement-continuation . 1417))
+ (((in-delete-clause "where")
+   . 1442)
+  (statement-continuation . 1417))
+ ((toplevel . 1))
+ ((toplevel . 1))
+ ((update-clause . 1576)
+  (statement-continuation . 1576))
+ (((in-update-clause "set")
+   . 1595)
+  (statement-continuation . 1576))
+ ((update-clause . 1576)
+  (statement-continuation . 1576))
+ (((in-update-clause "where")
+   . 1674)
+  (statement-continuation . 1576))
+ ((nested-statement-continuation . 1710)
+  (statement-continuation . 1710))
+ (((in-update-clause "where")
+   . 1674)
+  (statement-continuation . 1576))
+ (((in-update-clause "where")
+   . 1674)
+  (statement-continuation . 1576))
+ ((toplevel . 1))
+ ((toplevel . 1))
+ (((in-insert-clause "insert into")
+   . 1800)
+  (statement-continuation . 1800))
+ ((nested-statement-continuation . 1830)
+  (statement-continuation . 1830))
+ ((nested-statement-continuation . 1830)
+  (statement-continuation . 1830))
+ ((insert-clause . 1800)
+  (statement-continuation . 1800))
+ ((select-column . 1902)
+  (statement-continuation . 1800))
+ ((select-column . 1902)
+  (statement-continuation . 1800))
+ ((select-column . 1902)
+  (statement-continuation . 1800))
+ ((select-column . 1902)
+  (statement-continuation . 1800))
+ ((select-column . 1902)
+  (statement-continuation . 1800))
+ ((select-column . 1902)
+  (statement-continuation . 1800))
+ ((nested-statement-continuation . 2081)
+  (statement-continuation . 2081))
+ ((select-column . 1902)
+  (statement-continuation . 1800))
+ ((nested-statement-continuation . 2174)
+  (statement-continuation . 2174))
+ ((select-column . 1902)
+  (statement-continuation . 1800))
+ ((select-clause . 1902)
+  (statement-continuation . 1800))
+ ((select-column . 2293)
+  (nested-statement-continuation . 2292)
+  (statement-continuation . 2292))
+ ((select-column . 2293)
+  (nested-statement-continuation . 2292)
+  (statement-continuation . 2292))
+ ((nested-statement-continuation . 2403)
+  (statement-continuation . 2403))
+ ((nested-statement-continuation . 2403)
+  (statement-continuation . 2403))
+ ((select-clause . 2293)
+  (nested-statement-continuation . 2292)
+  (statement-continuation . 2292))
+ ((select-clause . 2278)
+  (nested-statement-continuation . 2277)
+  (statement-continuation . 2277))
+ ((select-table-continuation . 2271)
+  (statement-continuation . 1800))
+ ((select-column . 2650)
+  (nested-statement-continuation . 2649)
+  (statement-continuation . 2649))
+ ((select-clause . 2650)
+  (nested-statement-continuation . 2649)
+  (statement-continuation . 2649))
+ ((select-table-continuation . 2271)
+  (statement-continuation . 1800))
+ ((select-clause . 1902)
+  (statement-continuation . 1800))
+ (((in-select-clause "group by")
+   . 2769)
+  (statement-continuation . 1800))
+ ((select-clause . 1902)
+  (statement-continuation . 1800))
+ (((in-select-clause "order by")
+   . 2798)
+  (statement-continuation . 1800))
+ (((in-select-clause "order by")
+   . 2798)
+  (statement-continuation . 1800))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((toplevel . 1)))
+ 
diff --git a/test-data/pr17.sql b/test-data/pr17.sql
new file mode 100644
index 0000000..08f57d2
--- /dev/null
+++ b/test-data/pr17.sql
@@ -0,0 +1,94 @@
+clear columns
+set linesize 2500
+-- set trimout on
+-- set trimspool on
+
+select sysdate from dual;
+
+select col1, 'a long line of text ending with a single word'
+          || col2
+          || col3
+          || 'some text' as composed_column,
+       col4
+    || col5 as composed_column2
+  from   my_table
+ where  cond1 = fct1
+             || 'another text'
+    and    cond2 = 2;
+
+select atc.column_name,
+       atc.data_type,
+       data_length,
+       data_precision,
+       nullable,
+       data_scale,
+       nvl(substr(comments, 1, 100), atc.column_name) comments
+  from   all_tab_columns atc,
+         all_col_comments acc
+ where  atc.owner       = acc.owner
+    and    atc.table_name  = acc.table_name
+    and    atc.column_name = acc.column_name
+    and    atc.owner       = user
+    and    atc.table_name  = 'MY_TABLE'
+    and    atc.column_name = p_column_name
+    and    not exists (select 1
+                         from   all_tab_columns atc1,
+                                all_col_comments acc1
+                        where  atc1.owner       = acc1.owner
+                           and    atc1.table_name  = acc1.table_name
+                           and    atc1.column_name = acc1.column_name
+                           and    atc1.owner       = atc.owner
+                           and    atc1.table_name  = atc.table_name
+                           and    acc1.column_name = acc.column_name)
+ ;
+
+delete from my_table mt
+ where  col_1    = v_col1
+    and   (col_2    = v_col2
+           or col_3 = v_col3)
+    and   col_42    = '42'
+ ;
+
+update my_table
+   set    col1_has_a_long_name = value1,
+          col2_is_short        = value2
+ where cond1 is not null
+   and  (   col_2 = v_col2
+         or col_3 = v_col3)
+   and   col_42   = '42'
+ ;
+
+insert into xyzxx
+            ( aaa, xxx, bbb, ccc,
+            ddd, eee, fff, ggg,
+            hhh )
+select aaa,
+       xxx,
+       max (m.b1) as bbb,
+       min (m.b1) as ccc,
+       coalesce (max (n.c2), 0) as ddd,
+       coalesce (min (n.c2), 0) as eee,
+       max (m.b1) over ( partition by c2
+                        order by aaa desc ) as fff,
+       min (m.b1) over ( partition by c2
+                        order by aaa desc ) as ggg,
+       avg (n.c2) as hhh
+  from  (select * from (select aaa,
+                               jjj + kkk as b1,
+                               row_number () over ( partition by qqq
+                                                   order by rrr,
+                                                   sss ) as rn
+                          from mno) a_nested_nested
+          where rn = 1) m
+          inner join (select aaa,
+                             nnn + ooo as c2
+                        from   pqr) n
+          using (aaa),
+ group by aaa,
+          xxx
+ order by xxx desc,
+          aaa asc
+ ;
+-- Local Variables:
+-- sql-product: oracle
+-- End:
diff --git a/test-data/pr7-syn.eld b/test-data/pr7-syn.eld
new file mode 100644
index 0000000..48c6bdf
--- /dev/null
+++ b/test-data/pr7-syn.eld
@@ -0,0 +1,131 @@
+(((toplevel . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((block-end package "my_package")
+   . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((toplevel . 1)))
+ 
+ 
\ No newline at end of file
diff --git a/test-data/pr7.eld b/test-data/pr7.eld
new file mode 100644
index 0000000..48c6bdf
--- /dev/null
+++ b/test-data/pr7.eld
@@ -0,0 +1,131 @@
+(((toplevel . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  ((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((package "my_package")
+   . 1))
+ (((block-end package "my_package")
+   . 1)
+  ((package "my_package")
+   . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((toplevel . 1)))
+ 
+ 
\ No newline at end of file
diff --git a/test-data/pr7.sql b/test-data/pr7.sql
new file mode 100644
index 0000000..7e6f224
--- /dev/null
+++ b/test-data/pr7.sql
@@ -0,0 +1,47 @@
+create or replace package my_package authid current_user
+    -- Author  : me
+    -- Date    : 06/05/2017
+    -- Version : 715.00.0001
+    -- Object  : sample package
+    -- 
----------------------------------------------------------------------------
+
+    
-------------------------------------------------------------------------------
+    -- NAME    : simple_boolean_fct_1
+    -- CREATED : 06/05/2017
+    -- AUTHOR  : 
+    
-------------------------------------------------------------------------------
+    -- RET  : true if all goes well, false instead
+    
-------------------------------------------------------------------------------
+    -- DESC : dummy function
+    
-------------------------------------------------------------------------------
+    --
+    FUNCTION simple_boolean_fct_1(param1 in boolean)
+    RETURN   BOOLEAN;
+
+    
-------------------------------------------------------------------------------
+    -- NAME    : simple_boolean_fct_2
+    -- CREATED : 06/05/2017
+    -- AUTHOR  : 
+    
-------------------------------------------------------------------------------
+    -- RET  : true if all goes well, false instead
+    
-------------------------------------------------------------------------------
+    -- DESC : dummy function
+    
-------------------------------------------------------------------------------
+    FUNCTION simple_bolean_fct_2(param1 in boolean)
+    RETURN   BOOLEAN;
+
+    
-------------------------------------------------------------------------------
+    -- NAME    : simple_boolean_fct_3
+    -- CREATED : 06/05/2017
+    -- AUTHOR  : 
+    
-------------------------------------------------------------------------------
+    -- RET  : true if all goes well, false instead
+    
-------------------------------------------------------------------------------
+    -- DESC : dummy function
+    
-------------------------------------------------------------------------------
+    FUNCTION simple_boolean_fct_3(param1 in boolean)
+    RETURN   BOOLEAN;
+end my_package;
+-- Local Variables:
+-- sql-product: oracle
+-- End:

Reply via email to