Skip to content

Commit 6b2d83f

Browse files
committed
Merge pull request #1008 from gracjan/pr-guard-stack-overflow
Guard stack overflow, introduce a test
2 parents b6e159c + be6bba9 commit 6b2d83f

File tree

1 file changed

+130
-2
lines changed

1 file changed

+130
-2
lines changed

tests/haskell-indentation-tests.el

Lines changed: 130 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ because it helps increase coverage."
8080
(should
8181
(equal (cons (list (line-number-at-pos)
8282
(current-column))
83-
(haskell-indentation-find-indentations))
83+
(condition-case condition
84+
(haskell-indentation-find-indentations)
85+
(error
86+
;; for unknown reason Emacs 24.4 ERT does not
87+
;; catch overrun recursion, so we have to
88+
;; catch it here, and throw it again
89+
(signal (car condition) (cdr condition)))))
8490
current))))))
8591

8692
(defmacro hindent-test (name source &rest test-cases)
@@ -756,7 +762,129 @@ x = asum [ mzero
756762
function = abc
757763
def
758764
xyz"
759-
((3 0) 0 7))
765+
((3 0) 0 7))
766+
767+
(hindent-test "45* phrase should not eat whole stack" "
768+
function =
769+
if True
770+
then True
771+
else
772+
if True
773+
then True
774+
else
775+
if True
776+
then True
777+
else
778+
if True
779+
then True
780+
else
781+
if True
782+
then True
783+
else
784+
if True
785+
then True
786+
else
787+
if True
788+
then True
789+
else
790+
if True
791+
then True
792+
else
793+
if True
794+
then True
795+
else
796+
if True
797+
then True
798+
else
799+
if True
800+
then True
801+
else
802+
if True
803+
then True
804+
else
805+
if True
806+
then True
807+
else
808+
if True
809+
then True
810+
else
811+
if True
812+
then True
813+
else
814+
if True
815+
then True
816+
else
817+
if True
818+
then True
819+
else
820+
if True
821+
then True
822+
else
823+
if True
824+
then True
825+
else
826+
if True
827+
then True
828+
else
829+
if True
830+
then True
831+
else
832+
if True
833+
then True
834+
else
835+
if True
836+
then True
837+
else
838+
if True
839+
then True
840+
else
841+
if True
842+
then True
843+
else
844+
if True
845+
then True
846+
else
847+
if True
848+
then True
849+
else
850+
if True
851+
then True
852+
else
853+
if True
854+
then True
855+
else
856+
if True
857+
then True
858+
else
859+
if True
860+
then True
861+
else
862+
if True
863+
then True
864+
else
865+
if True
866+
then True
867+
else
868+
if True
869+
then True
870+
else
871+
if True
872+
then True
873+
else
874+
if True
875+
then True
876+
else
877+
if True
878+
then True
879+
else
880+
if True
881+
then True
882+
else
883+
if True
884+
then True
885+
else
886+
"
887+
((118 0) 0 4))
760888

761889

762890
(ert-deftest haskell-indentation-ret-indents ()

0 commit comments

Comments
 (0)