X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Finterface.impure.lisp;h=8b19a64a46f2daa2925575da8d13a6565de1d067;hb=22a6702974b7d6ff4e8f2b3b7b5ff446fc632de0;hp=ea21552ecb74f32016bc11c429e10f0ecd3c26b3;hpb=ed3295bc583cd14104130441e9ff1ad40fa5e484;p=sbcl.git diff --git a/tests/interface.impure.lisp b/tests/interface.impure.lisp index ea21552..8b19a64 100644 --- a/tests/interface.impure.lisp +++ b/tests/interface.impure.lisp @@ -79,4 +79,51 @@ (error "misbehavior in DESCRIBE of ~S" i)))) +;;; Tests of documentation on types and classes +(defclass foo () + () + (:documentation "FOO")) +(defstruct bar "BAR") +(define-condition baz () + () + (:documentation "BAZ")) +(deftype quux () + "QUUX" + 't) +(defstruct (frob (:type vector)) "FROB") +(macrolet + ((do-class (name expected &optional structurep) + `(progn + (assert (string= (documentation ',name 'type) ,expected)) + (assert (string= (documentation (find-class ',name) 'type) ,expected)) + (assert (string= (documentation (find-class ',name) 't) ,expected)) + ,@(when structurep + `((assert (string= (documentation ',name 'structure) ,expected)))) + (let ((new1 (symbol-name (gensym "NEW1"))) + (new2 (symbol-name (gensym "NEW2"))) + (new3 (symbol-name (gensym "NEW3"))) + (new4 (symbol-name (gensym "NEW4")))) + (declare (ignorable new4)) + (setf (documentation ',name 'type) new1) + (assert (string= (documentation (find-class ',name) 'type) new1)) + (setf (documentation (find-class ',name) 'type) new2) + (assert (string= (documentation (find-class ',name) 't) new2)) + (setf (documentation (find-class ',name) 't) new3) + (assert (string= (documentation ',name 'type) new3)) + ,@(when structurep + `((assert (string= (documentation ',name 'structure) new3)) + (setf (documentation ',name 'structure) new4) + (assert (string= (documentation ',name 'structure) new4)))))))) + (do-class foo "FOO") + (do-class bar "BAR" t) + (do-class baz "BAZ")) + +(assert (string= (documentation 'quux 'type) "QUUX")) +(setf (documentation 'quux 'type) "NEW4") +(assert (string= (documentation 'quux 'type) "NEW4")) + +(assert (string= (documentation 'frob 'structure) "FROB")) +(setf (documentation 'frob 'structure) "NEW5") +(assert (string= (documentation 'frob 'structure) "NEW5")) + ;;;; success