diff options
| author | Philipp Stephani | 2018-01-28 20:39:58 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2018-01-28 20:39:58 +0100 |
| commit | 614e9b322ec08cf6549cd4db34e1dc75149e6b31 (patch) | |
| tree | 8cd57c85e2fb92024b4d775621f9d630a8ff9b29 | |
| parent | d0733704b3dfae0f9487b0d1d8814b6ac8081981 (diff) | |
| download | emacs-614e9b322ec08cf6549cd4db34e1dc75149e6b31.tar.gz emacs-614e9b322ec08cf6549cd4db34e1dc75149e6b31.zip | |
Add missing module types to cl--typeof-types.
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add module
types.
* test/src/emacs-module-tests.el (emacs-module-tests--generic): New
helper function.
(module-function-object, mod-test-userptr-fun-test): Test that type
dispatching works with module types.
| -rw-r--r-- | lisp/emacs-lisp/cl-preloaded.el | 2 | ||||
| -rw-r--r-- | test/src/emacs-module-tests.el | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index 364de031334..2a70f9b9248 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el | |||
| @@ -60,12 +60,14 @@ | |||
| 60 | (marker number-or-marker atom) | 60 | (marker number-or-marker atom) |
| 61 | (overlay atom) (float number atom) (window-configuration atom) | 61 | (overlay atom) (float number atom) (window-configuration atom) |
| 62 | (process atom) (window atom) (subr atom) (compiled-function function atom) | 62 | (process atom) (window atom) (subr atom) (compiled-function function atom) |
| 63 | (module-function function atom) | ||
| 63 | (buffer atom) (char-table array sequence atom) | 64 | (buffer atom) (char-table array sequence atom) |
| 64 | (bool-vector array sequence atom) | 65 | (bool-vector array sequence atom) |
| 65 | (frame atom) (hash-table atom) (terminal atom) | 66 | (frame atom) (hash-table atom) (terminal atom) |
| 66 | (thread atom) (mutex atom) (condvar atom) | 67 | (thread atom) (mutex atom) (condvar atom) |
| 67 | (font-spec atom) (font-entity atom) (font-object atom) | 68 | (font-spec atom) (font-entity atom) (font-object atom) |
| 68 | (vector array sequence atom) | 69 | (vector array sequence atom) |
| 70 | (user-ptr atom) | ||
| 69 | ;; Plus, really hand made: | 71 | ;; Plus, really hand made: |
| 70 | (null symbol list sequence atom)) | 72 | (null symbol list sequence atom)) |
| 71 | "Alist of supertypes. | 73 | "Alist of supertypes. |
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 162af21bbec..a6407524ad7 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el | |||
| @@ -30,6 +30,14 @@ | |||
| 30 | 30 | ||
| 31 | (require 'mod-test mod-test-file) | 31 | (require 'mod-test mod-test-file) |
| 32 | 32 | ||
| 33 | (cl-defgeneric emacs-module-tests--generic (_)) | ||
| 34 | |||
| 35 | (cl-defmethod emacs-module-tests--generic ((_ module-function)) | ||
| 36 | 'module-function) | ||
| 37 | |||
| 38 | (cl-defmethod emacs-module-tests--generic ((_ user-ptr)) | ||
| 39 | 'user-ptr) | ||
| 40 | |||
| 33 | ;; | 41 | ;; |
| 34 | ;; Basic tests. | 42 | ;; Basic tests. |
| 35 | ;; | 43 | ;; |
| @@ -74,6 +82,7 @@ changes." | |||
| 74 | (should (module-function-p func)) | 82 | (should (module-function-p func)) |
| 75 | (should (functionp func)) | 83 | (should (functionp func)) |
| 76 | (should (equal (type-of func) 'module-function)) | 84 | (should (equal (type-of func) 'module-function)) |
| 85 | (should (eq (emacs-module-tests--generic func) 'module-function)) | ||
| 77 | (should (string-match-p | 86 | (should (string-match-p |
| 78 | (rx bos "#<module function " | 87 | (rx bos "#<module function " |
| 79 | (or "Fmod_test_sum" | 88 | (or "Fmod_test_sum" |
| @@ -149,6 +158,7 @@ changes." | |||
| 149 | (r (mod-test-userptr-get v))) | 158 | (r (mod-test-userptr-get v))) |
| 150 | 159 | ||
| 151 | (should (eq (type-of v) 'user-ptr)) | 160 | (should (eq (type-of v) 'user-ptr)) |
| 161 | (should (eq (emacs-module-tests--generic v) 'user-ptr)) | ||
| 152 | (should (integerp r)) | 162 | (should (integerp r)) |
| 153 | (should (= r n)))) | 163 | (should (= r n)))) |
| 154 | 164 | ||