0.9.1.2:
[sbcl.git] / tests / mop.impure.lisp
index ddc2e9b..28fccf3 100644 (file)
       (assert (null value))
       (assert (typep error 'error)))))
 
+;;; bug reported by David Morse: direct-subclass update protocol was broken
+(defclass vegetable () ())
+(defclass tomato (vegetable) ())
+(assert (equal (list (find-class 'tomato)) (sb-mop:class-direct-subclasses (find-class 'vegetable))))
+(defclass tomato () ())
+(assert (null (sb-mop:class-direct-subclasses (find-class 'vegetable))))
+
+;;; bug 331: lazy creation of clos classes for defstructs
+(defstruct bug-331-super)
+(defstruct (bug-331-sub (:include bug-331-super)))
+(let ((subs (sb-mop:class-direct-subclasses (find-class 'bug-331-super))))
+  (assert (= 1 (length subs)))
+  (assert (eq (car subs) (find-class 'bug-331-sub))))
+
+;;; detection of multiple class options in defclass, reported by Bruno Haible
+(defclass option-class (standard-class)
+  ((option :accessor cl-option :initarg :my-option)))
+(defmethod sb-pcl:validate-superclass ((c1 option-class) (c2 standard-class))
+  t)
+(multiple-value-bind (result error)
+    (ignore-errors (eval '(defclass option-class-instance ()
+                           ()
+                           (:my-option bar)
+                           (:my-option baz)
+                           (:metaclass option-class))))
+  (assert (not result))
+  (assert error))
+                         
 \f
 ;;;; success
 (sb-ext:quit :unix-status 104)