X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fclos-1.impure.lisp;h=c839585aba29e4b09230253e8cfed05095af0dd8;hb=5d5894082c39ca44da75d38859d669c7b2108f6a;hp=dc00ae44aa43d0ed3e4b9676385a0da0b032f102;hpb=a782418abea0bdb5d59d7d0cca9592459fe90832;p=sbcl.git diff --git a/tests/clos-1.impure.lisp b/tests/clos-1.impure.lisp index dc00ae4..c839585 100644 --- a/tests/clos-1.impure.lisp +++ b/tests/clos-1.impure.lisp @@ -88,8 +88,8 @@ (assert (= 3 (b-of *foo*))) (assert (raises-error? (c-of *foo*))))) -;; test that :documentation argument to slot specifiers are used as -;; the docstrings of accessor methods. +;;; test that :documentation argument to slot specifiers are used as +;;; the docstrings of accessor methods. (defclass foo () ((a :reader a-of :documentation "docstring for A") (b :writer set-b-of :documentation "docstring for B") @@ -97,7 +97,26 @@ (flet ((doc (fun) (documentation fun t))) - (assert (string= (doc (find-method #'a-of nil '((foo)))) "docstring for A")) - (assert (string= (doc (find-method #'set-b-of nil '(t (foo)))) "docstring for B")) - (assert (string= (doc (find-method #'c nil '((foo)))) "docstring for C")) - (assert (string= (doc (find-method #'(setf c) nil '(t (foo)))) "docstring for C"))) + (assert (string= (doc (find-method #'a-of nil '(foo))) "docstring for A")) + (assert (string= (doc (find-method #'set-b-of nil '(t foo))) "docstring for B")) + (assert (string= (doc (find-method #'c nil '(foo))) "docstring for C")) + (assert (string= (doc (find-method #'(setf c) nil '(t foo))) "docstring for C"))) + +;;; some nasty tests of NO-NEXT-METHOD. +(defvar *method-with-no-next-method*) +(defvar *nnm-count* 0) +(defun make-nnm-tester (x) + (setq *method-with-no-next-method* (defmethod nnm-tester ((y (eql x))) (call-next-method)))) +(make-nnm-tester 1) +(defmethod no-next-method ((gf (eql #'nnm-tester)) method &rest args) + (assert (eql method *method-with-no-next-method*)) + (incf *nnm-count*)) +(with-test (:name (no-next-method :unknown-specializer)) + (nnm-tester 1) + (assert (= *nnm-count* 1))) +(let ((gf #'nnm-tester)) + (reinitialize-instance gf :name 'new-nnm-tester) + (setf (fdefinition 'new-nnm-tester) gf)) +(with-test (:name (no-next-method :gf-name-changed)) + (new-nnm-tester 1) + (assert (= *nnm-count* 2)))