From: Stefan Kangas Date: Mon, 24 Mar 2025 20:20:11 +0000 (+0100) Subject: New test for function-get X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4f98d6ab6e97bd652a2c6ab0071f099bd863cf0b;p=emacs.git New test for function-get * test/lisp/subr-tests.el (subr-tests-function-get): New test. (cherry picked from commit 4194d5af4585fedfc7f148da72431a67a9c26045) --- diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 86538ed1431..df45b1f8a10 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -1285,6 +1285,22 @@ final or penultimate step during initialization.")) (nconc cycle cycle) (should-not (plistp cycle)))) +(defun subr-tests--some-fun ()) +(defalias 'subr-tests--some-alias #'subr-tests--some-fun) + +(ert-deftest subr-tests-function-get () + (unwind-protect + (progn + (should (eq (function-get 'subr-tests--some-fun 'prop) nil)) + (should (eq (function-get 'subr-tests--some-alias 'prop) nil)) + ;; With the function symbol directly. + (function-put 'subr-tests--some-fun 'prop 'value) + (should (eq (function-get 'subr-tests--some-fun 'prop) 'value)) + ;; With an alias. + (should (eq (function-get 'subr-tests--some-alias 'prop) 'value)) + (function-put 'subr-tests--some-alias 'prop 'value)) + (function-put 'subr-tests--some-fun 'prop nil))) + (defun subr-tests--butlast-ref (list &optional n) "Reference implementation of `butlast'." (let ((m (or n 1))