X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fmop.impure.lisp;h=35118d0cabd825ec633f47883b51cb479a0abaa9;hb=930a0e019b4c823da04d52e907d322a296fb9ae3;hp=f4c181d83048af5d5dc2f90a43c9748935b958e8;hpb=903f4432362a1e7764dfed46d35894625cc085d8;p=sbcl.git diff --git a/tests/mop.impure.lisp b/tests/mop.impure.lisp index f4c181d..35118d0 100644 --- a/tests/mop.impure.lisp +++ b/tests/mop.impure.lisp @@ -15,8 +15,10 @@ ;;;; However, this seems a good a way as any of ensuring that we have ;;;; no regressions. +(load "test-util.lisp") + (defpackage "MOP-TEST" - (:use "CL" "SB-MOP" "ASSERTOID")) + (:use "CL" "SB-MOP" "ASSERTOID" "TEST-UTIL")) (in-package "MOP-TEST") @@ -519,5 +521,38 @@ :metaclass 'funcallable-standard-class) (assert (eq (class-of (find-class 'better-be-standard-class)) (find-class 'standard-class))) + +;;; CLASS-SLOTS should signal an error for classes that are not yet +;;; finalized. Reported by Levente Meszaros on sbcl-devel. +(defclass has-slots-but-isnt-finalized () (a b c)) +(let ((class (find-class 'has-slots-but-isnt-finalized))) + (assert (not (sb-mop:class-finalized-p class))) + (assert (raises-error? (sb-mop:class-slots class) sb-kernel::reference-condition))) + +;;; Check that MAKE-METHOD-LAMBDA which wraps the original body doesn't +;;; break RETURN-FROM. +(defclass wrapped-generic (standard-generic-function) + () + (:metaclass sb-mop:funcallable-standard-class)) + +(defmethod sb-mop:make-method-lambda ((gf wrapped-generic) method lambda env) + (call-next-method gf method + `(lambda ,(second lambda) + (flet ((default () :default)) + ,@(cddr lambda))) + env)) + +(defgeneric wrapped (x) + (:generic-function-class wrapped-generic)) + +(defmethod wrapped ((x cons)) + (return-from wrapped (default))) + +(with-test (:name :make-method-lambda-wrapping+return-from) + (assert (eq :default (wrapped (cons t t))))) + +(with-test (:name :slow-method-is-fboundp) + (assert (fboundp '(sb-pcl::slow-method wrapped (cons)))) + (assert (eq :default (funcall #'(sb-pcl::slow-method wrapped (cons)) (list (cons t t)) nil)))) ;;;; success