]> git.eshelyaron.com Git - emacs.git/commitdiff
New test for function-get
authorStefan Kangas <stefankangas@gmail.com>
Mon, 24 Mar 2025 20:20:11 +0000 (21:20 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 25 Mar 2025 18:18:32 +0000 (19:18 +0100)
* test/lisp/subr-tests.el (subr-tests-function-get): New test.

(cherry picked from commit 4194d5af4585fedfc7f148da72431a67a9c26045)

test/lisp/subr-tests.el

index 86538ed14319076c6457de5fb863907bda7b8a46..df45b1f8a10bacdcc5332adbb1773bb77dbc2655 100644 (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))