diff options
Diffstat (limited to 'test/src')
| -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 @@ | |||
| 59 | (ert-deftest mod-test-sum-docstring () | 59 | (ert-deftest mod-test-sum-docstring () |
| 60 | (should (string= (documentation 'mod-test-sum) "Return A + B"))) | 60 | (should (string= (documentation 'mod-test-sum) "Return A + B"))) |
| 61 | 61 | ||
| 62 | (ert-deftest module-function-object () | ||
| 63 | "Extract and test the implementation of a module function. | ||
| 64 | This test needs to be changed whenever the implementation | ||
| 65 | changes." | ||
| 66 | (let ((func (symbol-function #'mod-test-sum))) | ||
| 67 | (should (consp func)) | ||
| 68 | (should (equal (length func) 4)) | ||
| 69 | (should (equal (nth 0 func) 'lambda)) | ||
| 70 | (should (equal (nth 1 func) '(&rest args))) | ||
| 71 | (should (equal (nth 2 func) "Return A + B")) | ||
| 72 | (let ((body (nth 3 func))) | ||
| 73 | (should (consp body)) | ||
| 74 | (should (equal (length body) 4)) | ||
| 75 | (should (equal (nth 0 body) #'apply)) | ||
| 76 | (should (equal (nth 1 body) '#'internal--module-call)) | ||
| 77 | (should (equal (nth 3 body) 'args)) | ||
| 78 | (let ((obj (nth 2 body))) | ||
| 79 | (should (equal (type-of obj) 'module-function)) | ||
| 80 | (should (string-match-p | ||
| 81 | (rx "#<module function Fmod_test_sum from " | ||
| 82 | (* nonl) "mod-test" (* nonl) ">") | ||
| 83 | (prin1-to-string obj))))))) | ||
| 84 | |||
| 62 | ;; | 85 | ;; |
| 63 | ;; Non-local exists (throw, signal). | 86 | ;; Non-local exists (throw, signal). |
| 64 | ;; | 87 | ;; |