New test for function-get

* test/lisp/subr-tests.el (subr-tests-function-get): New test.
This commit is contained in:
Stefan Kangas 2025-03-24 21:20:11 +01:00
parent 119931a9ce
commit 4194d5af45

View file

@ -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))