From: Stefan Kangas Date: Thu, 27 Feb 2025 23:33:00 +0000 (+0100) Subject: Add test for apply-partially X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d45123af34c206ce15cd7285cfdf2234bb6f46ab;p=emacs.git Add test for apply-partially * test/lisp/subr-tests.el (subr-test-apply-partially): New test. (cherry picked from commit 4ea2197f726835951ea55e04b88d212778676da1) --- diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 702502627f2..b21f90226c6 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -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))