diff tests/automated/lisp-tests.el @ 5550:b908c7265a2b

Add the #'apply-partially API, as used by GNU. lisp/ChangeLog addition: 2011-08-12 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el: * cl-macs.el (apply-partially): New compiler macro. * subr.el: * subr.el (apply-partially): New. Sync this function's API and docstring from GNU. The implementation is mine and trivial; the compiler macro in cl-macs.el ensures that partially-applied functions in compiled code are also compiled. tests/ChangeLog addition: 2011-08-12 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Trivial tests of #'apply-partially, just added to subr.el.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 12 Aug 2011 16:02:30 +0100
parents f2881cb841b4
children 62edcc6a11ec
line wrap: on
line diff
--- a/tests/automated/lisp-tests.el	Wed Aug 10 16:50:37 2011 +0100
+++ b/tests/automated/lisp-tests.el	Fri Aug 12 16:02:30 2011 +0100
@@ -2926,4 +2926,13 @@
   (Assert (equal '([symbol expansion] [copy expansion] [third expansion])
 		 (test-symbol-macrolet))))
 
+;; Basic tests of #'apply-partially.
+(let* ((four 4)
+       (times-four (apply-partially '* four))
+       (plus-twelve (apply-partially '+ 6 (* 3 2))))
+  (Assert (eql (funcall times-four 6) 24))
+  (Assert (eql (funcall times-four 4 4) 64))
+  (Assert (eql (funcall plus-twelve (funcall times-four 4) 4 4) 36))
+  (Check-Error wrong-number-of-arguments (apply-partially)))
+
 ;;; end of lisp-tests.el