summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/cl-macs-tests.el
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-04-18 15:30:29 +0900
committerYuuki Harano <masm+github@masm11.me>2021-04-18 15:30:29 +0900
commitde46c7796e635faf8647a7c6a5ae34fda9adae3b (patch)
tree1a2c5f85416a642300ca217b3d85ff1be5d9f35e /test/lisp/emacs-lisp/cl-macs-tests.el
parentfb5f3e694b0f6e2bccfc2124555c986fdc409cd0 (diff)
parent5c07cd0f156217db268ccb9fa64566fb429c4257 (diff)
downloademacs-de46c7796e635faf8647a7c6a5ae34fda9adae3b.tar.gz
emacs-de46c7796e635faf8647a7c6a5ae34fda9adae3b.tar.bz2
emacs-de46c7796e635faf8647a7c6a5ae34fda9adae3b.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'test/lisp/emacs-lisp/cl-macs-tests.el')
-rw-r--r--test/lisp/emacs-lisp/cl-macs-tests.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el
index dd6487603d3..f4e2e46a019 100644
--- a/test/lisp/emacs-lisp/cl-macs-tests.el
+++ b/test/lisp/emacs-lisp/cl-macs-tests.el
@@ -629,14 +629,25 @@ collection clause."
(let (n1)
(and xs
(progn (setq n1 (1+ n))
- (len2 (cdr xs) n1)))))))
+ (len2 (cdr xs) n1))))))
+ ;; Tail calls in error and success handlers.
+ (len3 (xs n)
+ (if xs
+ (condition-case k
+ (/ 1 (logand n 1))
+ (arith-error (len3 (cdr xs) (1+ n)))
+ (:success (len3 (cdr xs) (+ n k))))
+ n)))
(should (equal (len nil 0) 0))
(should (equal (len2 nil 0) 0))
+ (should (equal (len3 nil 0) 0))
(should (equal (len list-42 0) 42))
(should (equal (len2 list-42 0) 42))
+ (should (equal (len3 list-42 0) 42))
;; Should not bump into stack depth limits.
(should (equal (len list-42k 0) 42000))
- (should (equal (len2 list-42k 0) 42000))))
+ (should (equal (len2 list-42k 0) 42000))
+ (should (equal (len3 list-42k 0) 42000))))
;; Check that non-recursive functions are handled more efficiently.
(should (pcase (macroexpand '(cl-labels ((f (x) (+ x 1))) (f 5)))