diff options
Diffstat (limited to 'test/src/emacs-module-tests.el')
-rw-r--r-- | test/src/emacs-module-tests.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 93e85ae22db..7859fc5dce7 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -59,6 +59,29 @@ (ert-deftest mod-test-sum-docstring () (should (string= (documentation 'mod-test-sum) "Return A + B"))) +(ert-deftest module-function-object () + "Extract and test the implementation of a module function. +This test needs to be changed whenever the implementation +changes." + (let ((func (symbol-function #'mod-test-sum))) + (should (consp func)) + (should (equal (length func) 4)) + (should (equal (nth 0 func) 'lambda)) + (should (equal (nth 1 func) '(&rest args))) + (should (equal (nth 2 func) "Return A + B")) + (let ((body (nth 3 func))) + (should (consp body)) + (should (equal (length body) 4)) + (should (equal (nth 0 body) #'apply)) + (should (equal (nth 1 body) '#'internal--module-call)) + (should (equal (nth 3 body) 'args)) + (let ((obj (nth 2 body))) + (should (equal (type-of obj) 'module-function)) + (should (string-match-p + (rx "#<module function Fmod_test_sum from " + (* nonl) "mod-test" (* nonl) ">") + (prin1-to-string obj))))))) + ;; ;; Non-local exists (throw, signal). ;; |