]> git.eshelyaron.com Git - emacs.git/commitdiff
Add test for apply-partially
authorStefan Kangas <stefankangas@gmail.com>
Thu, 27 Feb 2025 23:33:00 +0000 (00:33 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 28 Feb 2025 11:20:19 +0000 (12:20 +0100)
* test/lisp/subr-tests.el (subr-test-apply-partially): New test.

(cherry picked from commit 4ea2197f726835951ea55e04b88d212778676da1)

test/lisp/subr-tests.el

index 702502627f2cf014f7e933ab11e30881182dafea..b21f90226c63420ca1384193f421cee8c05124d5 100644 (file)
 (require 'ert-x)
 (eval-when-compile (require 'cl-lib))
 
+(ert-deftest subr-test-apply-partially ()
+  (should (functionp (apply-partially #'identity)))
+  (should (functionp (apply-partially #'list 1 2 3)))
+  (should (equal (mapcar (apply-partially #'identity) '(9 cups of sugar))
+                 '(9 cups of sugar)))
+  (should (equal (mapcar (apply-partially #'eq 3) '(3 spoons of butter))
+                 '(t nil nil nil)))
+  (should (equal (funcall (apply-partially #'list 1 2 3) 4)
+                 '(1 2 3 4)))
+  (let* ((a 1) (b 2) (c 3)
+         (fun (apply-partially #'list a b c)))
+    (should (equal (funcall fun 4) '(1 2 3 4)))))
+
 (ert-deftest subr-test-zerop ()
   (should (zerop 0))
   (should (zerop 0.0))