aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog13
-rw-r--r--test/automated/eieio-test-persist.el11
-rw-r--r--test/automated/eieio-tests.el14
3 files changed, 31 insertions, 7 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 53e2c49c9d7..8e3b83efbb0 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,16 @@
12015-01-05 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * automated/eieio-tests.el (eieio-test-04-static-method)
4 (eieio-test-05-static-method-2): Use oref-default to access
5 class slots.
6 (eieio-test-23-inheritance-check): Don't assume that
7 eieio-class-parents returns class names, or that a class can only have
8 a single name.
9
10 * automated/eieio-test-persist.el (eieio--attribute-to-initarg):
11 Move from eieio-core.el. Rename from eieio-attribute-to-initarg.
12 Change arg to be a class object. Update all callers.
13
12014-12-29 Stefan Monnier <monnier@iro.umontreal.ca> 142014-12-29 Stefan Monnier <monnier@iro.umontreal.ca>
2 15
3 * automated/eieio-test-methodinvoke.el (eieio-test-method-store): 16 * automated/eieio-test-methodinvoke.el (eieio-test-method-store):
diff --git a/test/automated/eieio-test-persist.el b/test/automated/eieio-test-persist.el
index 00de3cf0d7c..5ea7cf25740 100644
--- a/test/automated/eieio-test-persist.el
+++ b/test/automated/eieio-test-persist.el
@@ -32,6 +32,14 @@
32(require 'eieio-base) 32(require 'eieio-base)
33(require 'ert) 33(require 'ert)
34 34
35(defun eieio--attribute-to-initarg (class attribute)
36 "In CLASS, convert the ATTRIBUTE into the corresponding init argument tag.
37This is usually a symbol that starts with `:'."
38 (let ((tuple (rassoc attribute (eieio--class-initarg-tuples class))))
39 (if tuple
40 (car tuple)
41 nil)))
42
35(defun persist-test-save-and-compare (original) 43(defun persist-test-save-and-compare (original)
36 "Compare the object ORIGINAL against the one read fromdisk." 44 "Compare the object ORIGINAL against the one read fromdisk."
37 45
@@ -53,7 +61,8 @@
53 (let* ((oneslot (car slot-names)) 61 (let* ((oneslot (car slot-names))
54 (origvalue (eieio-oref original oneslot)) 62 (origvalue (eieio-oref original oneslot))
55 (fromdiskvalue (eieio-oref fromdisk oneslot)) 63 (fromdiskvalue (eieio-oref fromdisk oneslot))
56 (initarg-p (eieio-attribute-to-initarg class oneslot)) 64 (initarg-p (eieio--attribute-to-initarg
65 (eieio--class-v class) oneslot))
57 ) 66 )
58 67
59 (if initarg-p 68 (if initarg-p
diff --git a/test/automated/eieio-tests.el b/test/automated/eieio-tests.el
index 91ddfc4fcf3..f3088bacf32 100644
--- a/test/automated/eieio-tests.el
+++ b/test/automated/eieio-tests.el
@@ -1,6 +1,6 @@
1;;; eieio-tests.el -- eieio tests routines 1;;; eieio-tests.el -- eieio tests routines
2 2
3;; Copyright (C) 1999-2003, 2005-2010, 2012-2014 Free Software Foundation, Inc. 3;; Copyright (C) 1999-2003, 2005-2010, 2012-2015 Free Software Foundation, Inc.
4 4
5;; Author: Eric M. Ludlam <zappo@gnu.org> 5;; Author: Eric M. Ludlam <zappo@gnu.org>
6 6
@@ -199,9 +199,9 @@ Argument C is the class bound to this static method."
199(ert-deftest eieio-test-04-static-method () 199(ert-deftest eieio-test-04-static-method ()
200 ;; Call static method on a class and see if it worked 200 ;; Call static method on a class and see if it worked
201 (static-method-class-method static-method-class 'class) 201 (static-method-class-method static-method-class 'class)
202 (should (eq (oref static-method-class some-slot) 'class)) 202 (should (eq (oref-default static-method-class some-slot) 'class))
203 (static-method-class-method (static-method-class) 'object) 203 (static-method-class-method (static-method-class) 'object)
204 (should (eq (oref static-method-class some-slot) 'object))) 204 (should (eq (oref-default static-method-class some-slot) 'object)))
205 205
206(ert-deftest eieio-test-05-static-method-2 () 206(ert-deftest eieio-test-05-static-method-2 ()
207 (defclass static-method-class-2 (static-method-class) 207 (defclass static-method-class-2 (static-method-class)
@@ -215,9 +215,9 @@ Argument C is the class bound to this static method."
215 (oset-default c some-slot (intern (concat "moose-" (symbol-name value))))) 215 (oset-default c some-slot (intern (concat "moose-" (symbol-name value)))))
216 216
217 (static-method-class-method static-method-class-2 'class) 217 (static-method-class-method static-method-class-2 'class)
218 (should (eq (oref static-method-class-2 some-slot) 'moose-class)) 218 (should (eq (oref-default static-method-class-2 some-slot) 'moose-class))
219 (static-method-class-method (static-method-class-2) 'object) 219 (static-method-class-method (static-method-class-2) 'object)
220 (should (eq (oref static-method-class-2 some-slot) 'moose-object))) 220 (should (eq (oref-default static-method-class-2 some-slot) 'moose-object)))
221 221
222 222
223;;; Perform method testing 223;;; Perform method testing
@@ -536,7 +536,9 @@ METHOD is the method that was attempting to be called."
536 (should (object-of-class-p eitest-ab class-b)) 536 (should (object-of-class-p eitest-ab class-b))
537 (should (object-of-class-p eitest-ab class-ab)) 537 (should (object-of-class-p eitest-ab class-ab))
538 (should (eq (eieio-class-parents class-a) nil)) 538 (should (eq (eieio-class-parents class-a) nil))
539 (should (equal (eieio-class-parents class-ab) '(class-a class-b))) 539 ;; FIXME: eieio-class-parents now returns class objects!
540 (should (equal (mapcar #'eieio-class-object (eieio-class-parents class-ab))
541 (mapcar #'eieio-class-object '(class-a class-b))))
540 (should (same-class-p eitest-a class-a)) 542 (should (same-class-p eitest-a class-a))
541 (should (class-a-p eitest-a)) 543 (should (class-a-p eitest-a))
542 (should (not (class-a-p eitest-ab))) 544 (should (not (class-a-p eitest-ab)))