comparison tests/automated/lisp-tests.el @ 4575:eecd28508f4a

Add #'subr-arity, API taken from GNU, implementation our own. lisp/ChangeLog addition: 2009-01-11 Aidan Kehoe <kehoea@parhasard.net> * subr.el: Correct a comment, we now have #'syntax-after in syntax.el. (subr-arity): New. Docstring and API taken initially from GNU's data.c, revision 1.275, GPLv2. tests/ChangeLog addition: 2009-01-11 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el (): Test #'subr-arity, recently added to subr.el.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 11 Jan 2009 13:18:42 +0000
parents e97f16fb2e25
children 1d11ecca9cd0
comparison
equal deleted inserted replaced
4574:302136a857ec 4575:eecd28508f4a
886 (eval 886 (eval
887 `(progn 887 `(progn
888 (defun test-fun ,arglist nil) 888 (defun test-fun ,arglist nil)
889 (check-function-argcounts '(lambda ,arglist nil) ,min ,max) 889 (check-function-argcounts '(lambda ,arglist nil) ,min ,max)
890 (check-function-argcounts (byte-compile '(lambda ,arglist nil)) ,min ,max)))) 890 (check-function-argcounts (byte-compile '(lambda ,arglist nil)) ,min ,max))))
891
892 ;; Test subr-arity.
893 (loop for (function-name arity) in
894 '((let (1 . unevalled))
895 (prog1 (1 . unevalled))
896 (list (0 . many))
897 (type-of (1 . 1))
898 (garbage-collect (0 . 0)))
899 do (Assert (equal (subr-arity (symbol-function function-name)) arity)))
900
901 (Check-Error wrong-type-argument (subr-arity
902 (lambda () (message "Hi there!"))))
903
904 (Check-Error wrong-type-argument (subr-arity nil))
891 905
892 ;;----------------------------------------------------- 906 ;;-----------------------------------------------------
893 ;; Detection of cyclic variable indirection loops 907 ;; Detection of cyclic variable indirection loops
894 ;;----------------------------------------------------- 908 ;;-----------------------------------------------------
895 (fset 'test-sym1 'test-sym1) 909 (fset 'test-sym1 'test-sym1)