summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/eieio-tests
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2019-05-08 07:51:48 -0700
committerGlenn Morris <rgm@gnu.org>2019-05-08 07:51:48 -0700
commit8b789755b45e6e10ed2809d7a7b89146b28452fc (patch)
tree044d0e819072fe86fddd064ce6b11a975072902b /test/lisp/emacs-lisp/eieio-tests
parent6734f2168c5f4f68a15325215c2054e7006f0e82 (diff)
parent1c6484e975e8b0e50d22980d02a3be6c9bf93b49 (diff)
downloademacs-8b789755b45e6e10ed2809d7a7b89146b28452fc.tar.gz
Merge from origin/emacs-26
1c6484e (origin/emacs-26) Fix incorrect cloning of eieio-instance-inh... 37436fe Fix cloning of eieio-named objects (Bug#22840) fb65a36 Fix ibuffer-unmark-backward synopsis (bug#35572) f77bd2b ; * src/lisp.h (DEFSYM): Fix inaccurate comment. 3b86e0b Clarify handling of long options (Bug#24949) 04340a8 Improve documentation of the daemon and emacsclient 3e29de2 * etc/NEWS.24: Belatedly announce delete-consecutive-dups.
Diffstat (limited to 'test/lisp/emacs-lisp/eieio-tests')
-rw-r--r--test/lisp/emacs-lisp/eieio-tests/eieio-tests.el56
1 files changed, 54 insertions, 2 deletions
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
index ea6df0f36fc..e6a35c4cd7a 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
@@ -696,6 +696,17 @@ Do not override for `prot-2'."
(setq eitest-II3 (clone eitest-II2 "eitest-II3 Test."))
(oset eitest-II3 slot3 'penguin)
+ ;; Test that slots are non-initialized slots are unbounded
+ (oref eitest-II2 slot1)
+ (should (slot-boundp eitest-II2 'slot1))
+ (should-not (slot-boundp eitest-II2 'slot2))
+ (should-not (slot-boundp eitest-II2 'slot3))
+ (should-not (slot-boundp eitest-II3 'slot2))
+ (should-not (slot-boundp eitest-II3 'slot1))
+ (should-not (slot-boundp eitest-II3 'slot2))
+ (should (eieio-instance-inheritor-slot-boundp eitest-II3 'slot2))
+ (should (slot-boundp eitest-II3 'slot3))
+
;; Test level 1 inheritance
(should (eq (oref eitest-II3 slot1) 'moose))
;; Test level 2 inheritance
@@ -862,8 +873,7 @@ Subclasses to override slot attributes.")
(should (oref obj1 a-slot))))
(defclass NAMED (eieio-named)
- ((some-slot :initform nil)
- )
+ ((some-slot :initform nil))
"A class inheriting from eieio-named.")
(ert-deftest eieio-test-35-named-object ()
@@ -902,6 +912,48 @@ Subclasses to override slot attributes.")
(should
(fboundp 'eieio--defalias)))
+(ert-deftest eieio-test-38-clone-named-object ()
+ (let* ((A (NAMED :object-name "aa"))
+ (B (clone A :object-name "bb"))
+ (C (clone A "cc"))
+ (D (clone A))
+ (E (clone D)))
+ (should (string= "aa" (oref A object-name)))
+ (should (string= "bb" (oref B object-name)))
+ (should (string= "cc" (oref C object-name)))
+ (should (string= "aa-1" (oref D object-name)))
+ (should (string= "aa-2" (oref E object-name)))))
+
+(defclass TII (eieio-instance-inheritor)
+ ((a :initform 1 :initarg :a)
+ (b :initarg :b)
+ (c :initarg :c))
+ "Instance Inheritor test class.")
+
+(ert-deftest eieio-test-39-clone-instance-inheritor-with-args ()
+ (let* ((A (TII))
+ (B (clone A :b "bb"))
+ (C (clone B :a "aa")))
+
+ (should (string= "aa" (oref C :a)))
+ (should (string= "bb" (oref C :b)))
+
+ (should (slot-boundp A :a))
+ (should-not (slot-boundp A :b))
+ (should-not (slot-boundp A :c))
+
+ (should-not (slot-boundp B :a))
+ (should (slot-boundp B :b))
+ (should-not (slot-boundp A :c))
+
+ (should (slot-boundp C :a))
+ (should-not (slot-boundp C :b))
+ (should-not (slot-boundp C :c))
+
+ (should (eieio-instance-inheritor-slot-boundp C :a))
+ (should (eieio-instance-inheritor-slot-boundp C :b))
+ (should-not (eieio-instance-inheritor-slot-boundp C :c))))
+
(provide 'eieio-tests)