X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fdefstruct.impure.lisp;h=f6761220666da5b05d5efcfbf32b8ce2edc1916d;hb=a5fbc248b7513f19a31e58a591a27868f30354ef;hp=1947bbd2c408caee16b9f2fa156de5376328c2d3;hpb=ba12c5c0420f28250ef4931b47af92c6d7963195;p=sbcl.git diff --git a/tests/defstruct.impure.lisp b/tests/defstruct.impure.lisp index 1947bbd..f676122 100644 --- a/tests/defstruct.impure.lisp +++ b/tests/defstruct.impure.lisp @@ -10,6 +10,7 @@ ;;;; more information. (load "assertoid.lisp") +(load "compiler-test-util.lisp") (use-package "ASSERTOID") ;;;; examples from, or close to, the Common Lisp DEFSTRUCT spec @@ -1112,3 +1113,29 @@ redefinition." (assert (eq t (boa-supplied-p.2-bar b2))) (assert (eq nil (boa-supplied-p.2-barp b1))) (assert (eq t (boa-supplied-p.2-barp b2))))) + +(defstruct structure-with-predicate) +(defclass class-to-be-redefined () ()) +(let ((x (make-instance 'class-to-be-redefined))) + (defun function-trampoline (fun) (funcall fun x))) + +(with-test (:name (:struct-predicate :obsolete-instance)) + (defclass class-to-be-redefined () ((a :initarg :a :initform 1))) + (function-trampoline #'structure-with-predicate-p)) + +(with-test (:name (:defstruct :not-toplevel-silent)) + (let ((sb-ext:*evaluator-mode* :compile)) + (handler-bind ((warning #'error)) + (eval `(let () + (defstruct destruct-no-warning-not-at-toplevel bar)))))) + +(with-test (:name :bug-941102) + (let ((test `((defstruct bug-941102) + (setf (find-class 'bug-941102-alias) (find-class 'bug-941102)) + (setf (find-class 'bug-941102-alias) nil)))) + (multiple-value-bind (warn fail) (ctu:file-compile test :load t) + (assert (not warn)) + (assert (not fail))) + (multiple-value-bind (warn2 fail2) (ctu:file-compile test) + (assert (not warn2)) + (assert (not fail2)))))