1 ;;;; miscellaneous side-effectful tests of the MOP
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
14 ;;; This isn't really a test of the MOP per se. PCL historically has
15 ;;; a CLASS-EQ specializer, which it uses internally to achieve
16 ;;; certain effects. There's no particular reason that it should be
17 ;;; exposed to the user, except that some people have asked for it at
18 ;;; some point; however, there is also no particular reason that code
19 ;;; using it should be gratuitously broken, as it was for a while by
20 ;;; the SB-PCL::PARAMETER-SPECIALIZER-DECLARATION-IN-DEFMETHOD
21 ;;; function. So it's fine if this test starts failing, as long as
24 (in-package "CL-USER")
26 (defclass super () ())
27 (defclass sub (super) ())
31 (defmethod test ((x t)) nil)
32 (let ((spec (sb-pcl::class-eq-specializer (find-class 'super))))
33 (eval `(defmethod test ((x ,spec)) t)))
35 (assert (test (make-instance 'super)))
36 (assert (null (test (make-instance 'sub))))
38 (let ((spec (sb-pcl::class-eq-specializer (find-class 't))))
39 (eval `(defmethod test ((x ,spec)) (class-of x))))
41 (assert (test (make-instance 'super)))
42 (assert (null (test (make-instance 'sub))))