diff 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
line wrap: on
line diff
--- a/tests/automated/lisp-tests.el	Sat Jan 03 15:41:34 2009 +0000
+++ b/tests/automated/lisp-tests.el	Sun Jan 11 13:18:42 2009 +0000
@@ -889,6 +889,20 @@
       (check-function-argcounts '(lambda ,arglist nil) ,min ,max)
       (check-function-argcounts (byte-compile '(lambda ,arglist nil)) ,min ,max))))
 
+;; Test subr-arity. 
+(loop for (function-name arity) in
+  '((let (1 . unevalled))
+    (prog1 (1 . unevalled))
+    (list (0 . many))
+    (type-of (1 . 1))
+    (garbage-collect (0 . 0)))
+  do (Assert (equal (subr-arity (symbol-function function-name)) arity)))
+  
+(Check-Error wrong-type-argument (subr-arity
+                                  (lambda () (message "Hi there!"))))
+  
+(Check-Error wrong-type-argument (subr-arity nil))
+
 ;;-----------------------------------------------------
 ;; Detection of cyclic variable indirection loops
 ;;-----------------------------------------------------