[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 614e9b3: Add missing module types to cl--typeof-typ
From: |
Philipp Stephani |
Subject: |
[Emacs-diffs] master 614e9b3: Add missing module types to cl--typeof-types. |
Date: |
Sun, 28 Jan 2018 14:41:03 -0500 (EST) |
branch: master
commit 614e9b322ec08cf6549cd4db34e1dc75149e6b31
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>
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.
---
lisp/emacs-lisp/cl-preloaded.el | 2 ++
test/src/emacs-module-tests.el | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el
index 364de03..2a70f9b 100644
--- a/lisp/emacs-lisp/cl-preloaded.el
+++ b/lisp/emacs-lisp/cl-preloaded.el
@@ -60,12 +60,14 @@
(marker number-or-marker atom)
(overlay atom) (float number atom) (window-configuration atom)
(process atom) (window atom) (subr atom) (compiled-function function atom)
+ (module-function function atom)
(buffer atom) (char-table array sequence atom)
(bool-vector array sequence atom)
(frame atom) (hash-table atom) (terminal atom)
(thread atom) (mutex atom) (condvar atom)
(font-spec atom) (font-entity atom) (font-object atom)
(vector array sequence atom)
+ (user-ptr atom)
;; Plus, really hand made:
(null symbol list sequence atom))
"Alist of supertypes.
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 162af21..a640752 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -30,6 +30,14 @@
(require 'mod-test mod-test-file)
+(cl-defgeneric emacs-module-tests--generic (_))
+
+(cl-defmethod emacs-module-tests--generic ((_ module-function))
+ 'module-function)
+
+(cl-defmethod emacs-module-tests--generic ((_ user-ptr))
+ 'user-ptr)
+
;;
;; Basic tests.
;;
@@ -74,6 +82,7 @@ changes."
(should (module-function-p func))
(should (functionp func))
(should (equal (type-of func) 'module-function))
+ (should (eq (emacs-module-tests--generic func) 'module-function))
(should (string-match-p
(rx bos "#<module function "
(or "Fmod_test_sum"
@@ -149,6 +158,7 @@ changes."
(r (mod-test-userptr-get v)))
(should (eq (type-of v) 'user-ptr))
+ (should (eq (emacs-module-tests--generic v) 'user-ptr))
(should (integerp r))
(should (= r n))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 614e9b3: Add missing module types to cl--typeof-types.,
Philipp Stephani <=