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 file attempts to test possible metacircularity issues arising
15 ;;; from adding slots to methods in odd places.
22 (defclass super-method ()
23 ((abc :accessor abc :initarg :abc)))
25 ;;; Test case reported by Jean Bresson sbcl-devel 2006-02-09
26 (defclass sub-generic-function1 (standard-generic-function) ()
27 (:metaclass funcallable-standard-class))
29 (defclass sub-method1 (standard-method super-method) ())
31 (defgeneric myfun1 (a b)
32 (:generic-function-class sub-generic-function1)
33 (:method-class sub-method1))
37 (defmethod myfun1 (a b)
41 (assert (= *count1* 1))
43 (assert (= *count1* 2))
45 (defmethod myfun1 ((a integer) (b integer))
49 (assert (= *count1* 4))
51 (assert (= *count1* 5))
53 ;;; Friendlier superclass order test case from Pascal Costanza
54 ;;; sbcl-devel 2006-02-09
55 (defclass sub-generic-function2 (standard-generic-function) ()
56 (:metaclass funcallable-standard-class))
58 (defclass sub-method2 (super-method standard-method) ())
60 (defgeneric myfun2 (a b)
61 (:generic-function-class sub-generic-function2)
62 (:method-class sub-method2))
66 (defmethod myfun2 (a b)
70 (assert (= *count2* 1))
72 (assert (= *count2* 2))
74 (defmethod myfun2 ((a integer) (b integer))
78 (assert (= *count2* 4))
80 (assert (= *count2* 5))