mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 10:31:37 -08:00
Merge remote-tracking branch 'savannah/master' into native-comp
This commit is contained in:
commit
0a7ac0b550
124 changed files with 2566 additions and 1052 deletions
|
|
@ -610,4 +610,27 @@ collection clause."
|
|||
;; Just make sure the function can be instrumented.
|
||||
(edebug-defun)))
|
||||
|
||||
;;; cl-labels
|
||||
|
||||
(ert-deftest cl-macs--labels ()
|
||||
;; Simple recursive function.
|
||||
(cl-labels ((len (xs) (if xs (1+ (len (cdr xs))) 0)))
|
||||
(should (equal (len (make-list 42 t)) 42)))
|
||||
|
||||
;; Simple tail-recursive function.
|
||||
(cl-labels ((len (xs n) (if xs (len (cdr xs) (1+ n)) n)))
|
||||
(should (equal (len (make-list 42 t) 0) 42))
|
||||
;; Should not bump into stack depth limits.
|
||||
(should (equal (len (make-list 42000 t) 0) 42000)))
|
||||
|
||||
;; Check that non-recursive functions are handled more efficiently.
|
||||
(should (pcase (macroexpand '(cl-labels ((f (x) (+ x 1))) (f 5)))
|
||||
(`(let* ,_ (funcall ,_ 5)) t)))
|
||||
|
||||
;; Case of "tail-recursive lambdas".
|
||||
(should (pcase (macroexpand
|
||||
'(cl-labels ((len (xs n) (if xs (len (cdr xs) (1+ n)) n)))
|
||||
#'len))
|
||||
(`(function (lambda (,_ ,_) . ,_)) t))))
|
||||
|
||||
;;; cl-macs-tests.el ends here
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@
|
|||
|
||||
(ert-deftest timer-tests-debug-timer-check ()
|
||||
;; This function exists only if --enable-checking.
|
||||
(if (fboundp 'debug-timer-check)
|
||||
(should (debug-timer-check)) t))
|
||||
(skip-unless (fboundp 'debug-timer-check))
|
||||
(should (debug-timer-check)))
|
||||
|
||||
(ert-deftest timer-test-multiple-of-time ()
|
||||
(should (time-equal-p
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue