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 generic functions in odd places.
22 (defclass super-funcallable-mixin
()
23 ((abc :accessor abc
:initarg
:abc
))
24 (:metaclass funcallable-standard-class
))
26 (defclass sub-generic-function1
(standard-generic-function
27 super-funcallable-mixin
) ()
28 (:metaclass funcallable-standard-class
))
30 (defclass sub-method1
(standard-method) ())
32 (defgeneric myfun1
(a b
)
33 (:generic-function-class sub-generic-function1
)
34 (:method-class sub-method1
))
38 (defmethod myfun1 (a b
)
42 (assert (= *count1
* 1))
44 (assert (= *count1
* 2))
46 (defmethod myfun1 ((a integer
) (b integer
))
50 (assert (= *count1
* 4))
52 (assert (= *count1
* 5))
54 ;;; Friendlier superclass order test case
55 (defclass sub-generic-function2
(super-funcallable-mixin
56 standard-generic-function
) ()
57 (:metaclass funcallable-standard-class
))
59 (defclass sub-method2
(standard-method) ())
61 (defgeneric myfun2
(a b
)
62 (:generic-function-class sub-generic-function2
)
63 (:method-class sub-method2
))
67 (defmethod myfun2 (a b
)
71 (assert (= *count2
* 1))
73 (assert (= *count2
* 2))
75 (defmethod myfun2 ((a integer
) (b integer
))
79 (assert (= *count2
* 4))
81 (assert (= *count2
* 5))