diff options
| author | Stefan Monnier | 2015-01-07 23:11:58 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2015-01-07 23:11:58 -0500 |
| commit | 1599688e95802c34f35819f5600a48a81248732c (patch) | |
| tree | 30de69970ba2e145c374e78b3a1606a443169771 /test | |
| parent | cb4db863192aed6c4d0b28e6490f08d5518ff3e7 (diff) | |
| download | emacs-1599688e95802c34f35819f5600a48a81248732c.tar.gz emacs-1599688e95802c34f35819f5600a48a81248732c.zip | |
lisp/emacs-lisp/eieio-core.el (eieio-backward-compatibility): New var.
* lisp/cedet/ede/speedbar.el (ede-speedbar-compile-line)
(ede-speedbar-get-top-project-for-line):
* lisp/cedet/ede.el (ede-buffer-belongs-to-target-p)
(ede-buffer-belongs-to-project-p, ede-build-forms-menu)
(ede-add-project-to-global-list):
* lisp/cedet/semantic/db-typecache.el (semanticdb-get-typecache):
* lisp/cedet/semantic/db-file.el (semanticdb-load-database):
* lisp/cedet/semantic/db-el.el (semanticdb-elisp-sym->tag):
* lisp/cedet/semantic/db-ebrowse.el (semanticdb-ebrowse-load-helper):
* lisp/cedet/ede/project-am.el (project-am-preferred-target-type):
* lisp/cedet/ede/proj.el (ede-proj-load):
* lisp/cedet/ede/custom.el (ede-customize-current-target, ede-customize-target):
* lisp/cedet/semantic/ede-grammar.el ("semantic grammar"):
* lisp/cedet/semantic/scope.el (semantic-scope-reset-cache)
(semantic-calculate-scope):
* lisp/cedet/srecode/map.el (srecode-map-update-map):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report)
(srecode-insert-method, srecode-insert-include-lookup)
(srecode-insert-method):
* lisp/cedet/srecode/fields.el (srecode-active-template-region):
* lisp/cedet/srecode/compile.el (srecode-flush-active-templates)
(srecode-compile-inserter): Don't use <class> as a variable.
Use `oref-default' for class slots.
* lisp/cedet/semantic/grammar.el (semantic-grammar-eldoc-last-data): New var.
(semantic-grammar-eldoc-get-macro-docstring): Use it instead of
eldoc-last-data.
* lisp/cedet/semantic/fw.el (semantic-exit-on-input): Use `declare'.
(semantic-throw-on-input): Use `with-current-buffer'.
* lisp/cedet/semantic/db.el (semanticdb-abstract-table-list): Define if not
pre-defined.
* lisp/cedet/semantic/db-find.el (semanticdb-find-tags-collector):
Use save-current-buffer.
(semanticdb-find-tags-collector): Don't use <class> as a variable.
* lisp/cedet/semantic/complete.el (semantic-complete-active-default)
(semantic-complete-current-matched-tag): Declare.
(semantic-complete-inline-custom-type): Don't use <class> as a variable.
* lisp/cedet/semantic/bovine/make.el (semantic-analyze-possible-completions):
Use with-current-buffer.
* lisp/cedet/semantic.el (semantic-parser-warnings): Declare.
* lisp/cedet/ede/base.el (ede-target-list): Define if not pre-defined.
(ede-with-projectfile): Prefer find-file-noselect over
save-window-excursion.
* lisp/emacs-lisp/chart.el (chart-add-sequence, chart-bar-quickie):
Don't use <class> as a variable.
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-validate/fix-slot-value):
Improve error messages.
(eieio-persistent-slot-type-is-class-p): Handle `list-of' types, as
well as user-defined types. Emit errors for legacy types like
<class>-child and <class>-list, if not eieio-backward-compatibility.
* lisp/emacs-lisp/eieio-core.el (eieio-backward-compatibility): New var.
(eieio-defclass-autoload): Obey it.
(eieio--class-object): Improve error behavior.
(eieio-class-children-fast, same-class-fast-p): Remove. Inline at
every use site.
(eieio--defgeneric-form-primary-only): Rename from
eieio-defgeneric-form-primary-only; update all callers.
(eieio--defgeneric-form-primary-only-one): Rename from
eieio-defgeneric-form-primary-only-one; update all callers.
(eieio-defgeneric-reset-generic-form)
(eieio-defgeneric-reset-generic-form-primary-only)
(eieio-defgeneric-reset-generic-form-primary-only-one): Remove.
(eieio--method-optimize-primary): New function to replace them.
(eieio--defmethod, eieio-defmethod): Use it.
(eieio--perform-slot-validation): Rename from
eieio-perform-slot-validation; update all callers.
(eieio--validate-slot-value): Rename from eieio-validate-slot-value.
Change `class' to be a class object. Update all callers.
(eieio--validate-class-slot-value): Rename from
eieio-validate-class-slot-value. Change `class' to be a class object.
Update all callers.
(eieio-oset-default): Accept class object as well.
(eieio--generic-call-primary-only): Rename from
eieio-generic-call-primary-only. Update all callers.
* lisp/emacs-lisp/eieio-opt.el (eieio-read-generic-p): Remove.
(eieio-read-generic): Use `generic-p' instead.
* lisp/emacs-lisp/eieio.el (same-class-p): Accept class object as well.
(call-next-method): Simplify.
(clone): Obey eieio-backward-compatibility.
* lisp/gnus/registry.el: Don't use <class> as a variable.
* test/automated/eieio-test-methodinvoke.el
(eieio-test-method-order-list-4):
Don't use <class> as a variable.
* test/automated/eieio-test-persist.el (persistent-with-objs-list-slot):
Don't use <class>-list type.
* test/automated/eieio-tests.el: Use cl-lib. Don't use <class> as a variable.
Don't use <class>-list types and <class>-list-p predicates.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 14 | ||||
| -rw-r--r-- | test/automated/eieio-test-methodinvoke.el | 2 | ||||
| -rw-r--r-- | test/automated/eieio-test-persist.el | 2 | ||||
| -rw-r--r-- | test/automated/eieio-tests.el | 52 |
4 files changed, 41 insertions, 29 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 8e3b83efbb0..bb480280970 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2015-01-07 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * automated/eieio-tests.el: Use cl-lib. Don't use <class> as a variable. | ||
| 4 | Don't use <class>-list types and <class>-list-p predicates. | ||
| 5 | |||
| 6 | * automated/eieio-test-persist.el (persistent-with-objs-list-slot): | ||
| 7 | Don't use <class>-list type. | ||
| 8 | |||
| 9 | * automated/eieio-test-methodinvoke.el | ||
| 10 | (eieio-test-method-order-list-4): | ||
| 11 | Don't use <class> as a variable. | ||
| 12 | |||
| 1 | 2015-01-05 Stefan Monnier <monnier@iro.umontreal.ca> | 13 | 2015-01-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 14 | ||
| 3 | * automated/eieio-tests.el (eieio-test-04-static-method) | 15 | * automated/eieio-tests.el (eieio-test-04-static-method) |
| @@ -2423,7 +2435,7 @@ | |||
| 2423 | ;; coding: utf-8 | 2435 | ;; coding: utf-8 |
| 2424 | ;; End: | 2436 | ;; End: |
| 2425 | 2437 | ||
| 2426 | Copyright (C) 2008-2014 Free Software Foundation, Inc. | 2438 | Copyright (C) 2008-2015 Free Software Foundation, Inc. |
| 2427 | 2439 | ||
| 2428 | This file is part of GNU Emacs. | 2440 | This file is part of GNU Emacs. |
| 2429 | 2441 | ||
diff --git a/test/automated/eieio-test-methodinvoke.el b/test/automated/eieio-test-methodinvoke.el index f99ee8d1f46..7790c13327f 100644 --- a/test/automated/eieio-test-methodinvoke.el +++ b/test/automated/eieio-test-methodinvoke.el | |||
| @@ -145,7 +145,7 @@ | |||
| 145 | 145 | ||
| 146 | (ert-deftest eieio-test-method-order-list-4 () | 146 | (ert-deftest eieio-test-method-order-list-4 () |
| 147 | ;; Both of these situations should succeed. | 147 | ;; Both of these situations should succeed. |
| 148 | (should (eitest-H eitest-A)) | 148 | (should (eitest-H 'eitest-A)) |
| 149 | (should (eitest-H (eitest-A nil)))) | 149 | (should (eitest-H (eitest-A nil)))) |
| 150 | 150 | ||
| 151 | ;;; Return value from :PRIMARY | 151 | ;;; Return value from :PRIMARY |
diff --git a/test/automated/eieio-test-persist.el b/test/automated/eieio-test-persist.el index 5ea7cf25740..d6f7c90e18c 100644 --- a/test/automated/eieio-test-persist.el +++ b/test/automated/eieio-test-persist.el | |||
| @@ -203,7 +203,7 @@ persistent class.") | |||
| 203 | ;; A slot that contains another object that isn't persistent | 203 | ;; A slot that contains another object that isn't persistent |
| 204 | (defclass persistent-with-objs-list-slot (eieio-persistent) | 204 | (defclass persistent-with-objs-list-slot (eieio-persistent) |
| 205 | ((pnp :initarg :pnp | 205 | ((pnp :initarg :pnp |
| 206 | :type persist-not-persistent-list | 206 | :type (list-of persist-not-persistent) |
| 207 | :initform nil)) | 207 | :initform nil)) |
| 208 | "Class for testing the saving of slots with objects in them.") | 208 | "Class for testing the saving of slots with objects in them.") |
| 209 | 209 | ||
diff --git a/test/automated/eieio-tests.el b/test/automated/eieio-tests.el index f3088bacf32..13f4a5728ed 100644 --- a/test/automated/eieio-tests.el +++ b/test/automated/eieio-tests.el | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | (require 'eieio-base) | 28 | (require 'eieio-base) |
| 29 | (require 'eieio-opt) | 29 | (require 'eieio-opt) |
| 30 | 30 | ||
| 31 | (eval-when-compile (require 'cl)) | 31 | (eval-when-compile (require 'cl-lib)) |
| 32 | 32 | ||
| 33 | ;;; Code: | 33 | ;;; Code: |
| 34 | ;; Set up some test classes | 34 | ;; Set up some test classes |
| @@ -198,10 +198,10 @@ Argument C is the class bound to this static method." | |||
| 198 | 198 | ||
| 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-default 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-default 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) |
| @@ -214,10 +214,10 @@ Argument C is the class bound to this static method." | |||
| 214 | (if (eieio-object-p c) (setq c (eieio-object-class c))) | 214 | (if (eieio-object-p c) (setq c (eieio-object-class c))) |
| 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-default 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-default 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 |
| @@ -473,12 +473,12 @@ METHOD is the method that was attempting to be called." | |||
| 473 | 473 | ||
| 474 | ;; Slot should be bound | 474 | ;; Slot should be bound |
| 475 | (should (slot-boundp eitest-a 'classslot)) | 475 | (should (slot-boundp eitest-a 'classslot)) |
| 476 | (should (slot-boundp class-a 'classslot)) | 476 | (should (slot-boundp 'class-a 'classslot)) |
| 477 | 477 | ||
| 478 | (slot-makeunbound eitest-a 'classslot) | 478 | (slot-makeunbound eitest-a 'classslot) |
| 479 | 479 | ||
| 480 | (should-not (slot-boundp eitest-a 'classslot)) | 480 | (should-not (slot-boundp eitest-a 'classslot)) |
| 481 | (should-not (slot-boundp class-a 'classslot))) | 481 | (should-not (slot-boundp 'class-a 'classslot))) |
| 482 | 482 | ||
| 483 | 483 | ||
| 484 | (defvar eieio-test-permuting-value nil) | 484 | (defvar eieio-test-permuting-value nil) |
| @@ -529,17 +529,17 @@ METHOD is the method that was attempting to be called." | |||
| 529 | :type 'invalid-slot-type)) | 529 | :type 'invalid-slot-type)) |
| 530 | 530 | ||
| 531 | (ert-deftest eieio-test-23-inheritance-check () | 531 | (ert-deftest eieio-test-23-inheritance-check () |
| 532 | (should (child-of-class-p class-ab class-a)) | 532 | (should (child-of-class-p 'class-ab 'class-a)) |
| 533 | (should (child-of-class-p class-ab class-b)) | 533 | (should (child-of-class-p 'class-ab 'class-b)) |
| 534 | (should (object-of-class-p eitest-a class-a)) | 534 | (should (object-of-class-p eitest-a 'class-a)) |
| 535 | (should (object-of-class-p eitest-ab class-a)) | 535 | (should (object-of-class-p eitest-ab 'class-a)) |
| 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 | ;; FIXME: eieio-class-parents now returns class objects! | 539 | ;; FIXME: eieio-class-parents now returns class objects! |
| 540 | (should (equal (mapcar #'eieio-class-object (eieio-class-parents class-ab)) | 540 | (should (equal (mapcar #'eieio-class-object (eieio-class-parents 'class-ab)) |
| 541 | (mapcar #'eieio-class-object '(class-a class-b)))) | 541 | (mapcar #'eieio-class-object '(class-a class-b)))) |
| 542 | (should (same-class-p eitest-a class-a)) | 542 | (should (same-class-p eitest-a 'class-a)) |
| 543 | (should (class-a-p eitest-a)) | 543 | (should (class-a-p eitest-a)) |
| 544 | (should (not (class-a-p eitest-ab))) | 544 | (should (not (class-a-p eitest-ab))) |
| 545 | (should (class-a-child-p eitest-a)) | 545 | (should (class-a-child-p eitest-a)) |
| @@ -550,10 +550,10 @@ METHOD is the method that was attempting to be called." | |||
| 550 | (ert-deftest eieio-test-24-object-predicates () | 550 | (ert-deftest eieio-test-24-object-predicates () |
| 551 | (let ((listooa (list (class-ab) (class-a))) | 551 | (let ((listooa (list (class-ab) (class-a))) |
| 552 | (listoob (list (class-ab) (class-b)))) | 552 | (listoob (list (class-ab) (class-b)))) |
| 553 | (should (class-a-list-p listooa)) | 553 | (should (cl-typep listooa '(list-of class-a))) |
| 554 | (should (class-b-list-p listoob)) | 554 | (should (cl-typep listoob '(list-of class-b))) |
| 555 | (should-not (class-b-list-p listooa)) | 555 | (should-not (cl-typep listooa '(list-of class-b))) |
| 556 | (should-not (class-a-list-p listoob)))) | 556 | (should-not (cl-typep listoob '(list-of class-a))))) |
| 557 | 557 | ||
| 558 | (defvar eitest-t1 nil) | 558 | (defvar eitest-t1 nil) |
| 559 | (ert-deftest eieio-test-25-slot-tests () | 559 | (ert-deftest eieio-test-25-slot-tests () |
| @@ -568,7 +568,7 @@ METHOD is the method that was attempting to be called." | |||
| 568 | ;; Pass string instead of symbol | 568 | ;; Pass string instead of symbol |
| 569 | (should-error (class-c :moose "not a symbol") :type 'invalid-slot-type) | 569 | (should-error (class-c :moose "not a symbol") :type 'invalid-slot-type) |
| 570 | (should (eq (get-slot-3 eitest-t1) 'emu)) | 570 | (should (eq (get-slot-3 eitest-t1) 'emu)) |
| 571 | (should (eq (get-slot-3 class-c) 'emu)) | 571 | (should (eq (get-slot-3 'class-c) 'emu)) |
| 572 | ;; Check setf | 572 | ;; Check setf |
| 573 | (setf (get-slot-3 eitest-t1) 'setf-emu) | 573 | (setf (get-slot-3 eitest-t1) 'setf-emu) |
| 574 | (should (eq (get-slot-3 eitest-t1) 'setf-emu)) | 574 | (should (eq (get-slot-3 eitest-t1) 'setf-emu)) |
| @@ -793,7 +793,7 @@ Subclasses to override slot attributes.") | |||
| 793 | ((type :type string) | 793 | ((type :type string) |
| 794 | ) | 794 | ) |
| 795 | "This class should throw an error."))) | 795 | "This class should throw an error."))) |
| 796 | (should (eq (oref-default slotattr-class-ok initform) 'no-init))) | 796 | (should (eq (oref-default 'slotattr-class-ok initform) 'no-init))) |
| 797 | 797 | ||
| 798 | (ert-deftest eieio-test-32-slot-attribute-override-2 () | 798 | (ert-deftest eieio-test-32-slot-attribute-override-2 () |
| 799 | (let* ((cv (eieio--class-v 'slotattr-ok)) | 799 | (let* ((cv (eieio--class-v 'slotattr-ok)) |
| @@ -883,8 +883,8 @@ Subclasses to override slot attributes.") | |||
| 883 | "Instantiable child") | 883 | "Instantiable child") |
| 884 | 884 | ||
| 885 | (ert-deftest eieio-test-36-build-class-alist () | 885 | (ert-deftest eieio-test-36-build-class-alist () |
| 886 | (should (= (length (eieio-build-class-alist opt-test1 nil)) 2)) | 886 | (should (= (length (eieio-build-class-alist 'opt-test1 nil)) 2)) |
| 887 | (should (= (length (eieio-build-class-alist opt-test1 t)) 1))) | 887 | (should (= (length (eieio-build-class-alist 'opt-test1 t)) 1))) |
| 888 | 888 | ||
| 889 | (provide 'eieio-tests) | 889 | (provide 'eieio-tests) |
| 890 | 890 | ||