MAP calls SB-SEQUENCE:MAP for extended sequences
[sbcl.git] / tests / mop-26.impure.lisp
blobc7a2b2b1383be4df62c486c4f1846ee9c8f72d1c
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 (in-package "CL-USER")
26 (defclass super () ())
27 (defclass sub (super) ())
29 (defgeneric test (x))
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))))