diff options
author | Paul Pogonyshev <pogonyshev@gmail.com> | 2016-03-26 11:19:43 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2016-03-26 11:19:43 +0300 |
commit | 6f3243db55e61847784178ea812f28ddf003544a (patch) | |
tree | e2bbb4e4c3a49ab661524135c6b1a610580431b8 /test/src/fns-tests.el | |
parent | 368b9bb45f125061506d43af4bd4791ab2cfd7b9 (diff) | |
download | emacs-6f3243db55e61847784178ea812f28ddf003544a.tar.gz emacs-6f3243db55e61847784178ea812f28ddf003544a.tar.bz2 emacs-6f3243db55e61847784178ea812f28ddf003544a.zip |
Implement 'func-arity'
* src/eval.c (Ffunc_arity, lambda_arity): New functions.
* src/bytecode.c (get_byte_code_arity): New function.
* src/lisp.h (get_byte_code_arity): Add prototype.
* doc/lispref/functions.texi (What Is a Function): Document
'func-arity'.
* etc/NEWS: Mention 'func-arity'.
* test/src/fns-tests.el (fns-tests-func-arity): New test set.
Diffstat (limited to 'test/src/fns-tests.el')
-rw-r--r-- | test/src/fns-tests.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 861736995f4..688ff1f6bd9 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -208,3 +208,14 @@ (should (string-version-lessp "foo1.25.5.png" "foo1.125.5")) (should (string-version-lessp "2" "1245")) (should (not (string-version-lessp "1245" "2")))) + +(ert-deftest fns-tests-func-arity () + (should (equal (func-arity 'car) '(1 . 1))) + (should (equal (func-arity 'caar) '(1 . 1))) + (should (equal (func-arity 'format) '(1 . many))) + (require 'info) + (should (equal (func-arity 'Info-goto-node) '(1 . 3))) + (should (equal (func-arity (lambda (&rest x))) '(0 . many))) + (should (equal (func-arity (eval (lambda (x &optional y)) nil)) '(1 . 2))) + (should (equal (func-arity (eval (lambda (x &optional y)) t)) '(1 . 2))) + (should (equal (func-arity 'let) '(1 . unevalled)))) |