X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fmop.impure.lisp;h=01b2796b7b5b1f24665f1ee2df9a6df1a9920d18;hb=d7875c296a4988e9f27e2776237884deb1984c62;hp=96904b8f2117974e045d889821d6047439d0df11;hpb=1439811447104b32d986bab40d6e2ed431247004;p=sbcl.git diff --git a/tests/mop.impure.lisp b/tests/mop.impure.lisp index 96904b8..01b2796 100644 --- a/tests/mop.impure.lisp +++ b/tests/mop.impure.lisp @@ -645,5 +645,49 @@ ((foo :initarg :foo :reader foofoo :function car)) (:metaclass func-slot-class))) (assert (eq x (foofoo o))))) + +(defclass class-slot-removal-test () + ((instance :initform 1) + (class :allocation :class :initform :ok))) + +(defmethod update-instance-for-redefined-class ((x class-slot-removal-test) added removed plist &rest inits) + (throw 'update-instance + (list added removed plist inits))) + +(with-test (:name :class-redefinition-removes-class-slot) + (let ((o (make-instance 'class-slot-removal-test))) + (assert (equal '(nil nil nil nil) + (catch 'update-instance + (eval `(defclass class-slot-removal-test () + ((instance :initform 2)))) + (slot-value o 'instance)))))) + +(defclass class-slot-add-test () + ((instance :initform 1))) + +(defmethod update-instance-for-redefined-class ((x class-slot-add-test) added removed plist &rest inits) + (throw 'update-instance + (list added removed plist inits))) + +(with-test (:name :class-redefinition-adds-class-slot) + (let ((o (make-instance 'class-slot-add-test))) + (assert (equal '(nil nil nil nil) + (catch 'update-instance + (eval `(defclass class-slot-add-test () + ((instance :initform 2) + (class :allocation :class :initform :ok)))) + (slot-value o 'instance)))))) + +(defgeneric definitely-a-funcallable-instance (x)) +(with-test (:name (set-funcallable-instance-function :typechecking)) + (assert (raises-error? (set-funcallable-instance-function + (lambda (y) nil) + #'definitely-a-funcallable-instance) + type-error))) + +(with-test (:name (defstruct :nil-slot-name :bug-633911)) + (defstruct nil-slot-name nil) + (let ((fun (compile nil '(lambda (x) (slot-value x 'nil))))) + (assert (= 3 (funcall fun (make-nil-slot-name :nil 3)))))) ;;;; success