Add test for apply-partially

* test/lisp/subr-tests.el (subr-test-apply-partially): New test.
This commit is contained in:
Stefan Kangas 2025-02-28 00:33:00 +01:00
parent 8a3e19f4b3
commit 4ea2197f72

View file

@ -30,6 +30,19 @@
(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))