aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorPhilipp Stephani2018-01-28 20:39:58 +0100
committerPhilipp Stephani2018-01-28 20:39:58 +0100
commit614e9b322ec08cf6549cd4db34e1dc75149e6b31 (patch)
tree8cd57c85e2fb92024b4d775621f9d630a8ff9b29 /test/src
parentd0733704b3dfae0f9487b0d1d8814b6ac8081981 (diff)
downloademacs-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.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/emacs-module-tests.el10
1 files changed, 10 insertions, 0 deletions
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