Add optimizers from string=* for simple-base-string= too.
[sbcl.git] / tests / mop-26.impure.lisp
blob1aea695eba251bd7e2f6b5bc7c23a9c4815ca008
1 ;;;; miscellaneous side-effectful tests of the MOP
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
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
8 ;;;; from CMU CL.
9 ;;;;
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
22 ;;; it's deliberate.
24 (defclass super () ())
25 (defclass sub (super) ())
27 (defgeneric test (x))
29 (defmethod test ((x t)) nil)
30 (let ((spec (sb-pcl::class-eq-specializer (find-class 'super))))
31 (eval `(defmethod test ((x ,spec)) t)))
33 (with-test (:name (:mop-26 1))
34 (assert (test (make-instance 'super)))
35 (assert (null (test (make-instance 'sub)))))
37 (let ((spec (sb-pcl::class-eq-specializer (find-class 't))))
38 (eval `(defmethod test ((x ,spec)) (class-of x))))
40 (with-test (:name (:mop-26 2))
41 (assert (test (make-instance 'super)))
42 (assert (null (test (make-instance 'sub)))))