summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2015-03-16 16:11:38 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2015-03-16 16:11:38 -0400
commit801eda8a2a00b3f28a69ffe51b05a649fffc5c58 (patch)
tree9beec244007c80b46089fd63a2092bf6bcf05238 /test
parentf925fc93bac41d7622d1af927e33b0e738ff55b0 (diff)
downloademacs-801eda8a2a00b3f28a69ffe51b05a649fffc5c58.tar.gz
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Optimize &aux.
Rework to avoid cl--do-arglist in more cases; add comments to explain what's going on. (cl--do-&aux): New function extracted from cl--do-arglist. (cl--do-arglist): Use it. * lisp/emacs-lisp/cl-generic.el: Add Version: header, for ELPA purposes.
Diffstat (limited to 'test')
-rw-r--r--test/automated/cl-lib-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/automated/cl-lib-tests.el b/test/automated/cl-lib-tests.el
index 1c36e7d7abf..2c188a40059 100644
--- a/test/automated/cl-lib-tests.el
+++ b/test/automated/cl-lib-tests.el
@@ -427,4 +427,21 @@
(ert-deftest cl-flet-test ()
(should (equal (cl-flet ((f1 (x) x)) (let ((x #'f1)) (funcall x 5))) 5)))
+(ert-deftest cl-lib-test-typep ()
+ (cl-deftype cl-lib-test-type (&optional x) `(member ,x))
+ ;; Make sure we correctly implement the rule that deftype's optional args
+ ;; default to `*' rather than to nil.
+ (should (cl-typep '* 'cl-lib-test-type))
+ (should-not (cl-typep 1 'cl-lib-test-type)))
+
+(ert-deftest cl-lib-arglist-performance ()
+ ;; An `&aux' should not cause lambda's arglist to be turned into an &rest
+ ;; that's parsed by hand.
+ (should (eq () (nth 1 (nth 1 (macroexpand
+ '(cl-function (lambda (&aux (x 1)) x)))))))
+ (cl-defstruct (cl-lib--s (:constructor cl-lib--s-make (&optional a))) a)
+ ;; Similarly the &cl-defs thingy shouldn't cause fallback to manual parsing
+ ;; of args if the default for optional args is nil.
+ (should (equal '(&optional a) (help-function-arglist 'cl-lib--s-make))))
+
;;; cl-lib.el ends here