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.
17 (defclass super-funcallable-mixin
()
18 ((abc :accessor abc
:initarg
:abc
))
19 (:metaclass sb-mop
:funcallable-standard-class
))
21 (defclass sub-generic-function1
(standard-generic-function
22 super-funcallable-mixin
) ()
23 (:metaclass sb-mop
:funcallable-standard-class
))
25 (defclass sub-method1
(standard-method) ())
27 (defgeneric myfun1
(a b
)
28 (:generic-function-class sub-generic-function1
)
29 (:method-class sub-method1
))
33 (defmethod myfun1 (a b
)
36 (with-test (:name
(:mop-13
1))
38 (assert (= *count1
* 1))
40 (assert (= *count1
* 2)))
42 (defmethod myfun1 ((a integer
) (b integer
))
45 (with-test (:name
(:mop-13
2))
47 (assert (= *count1
* 4))
49 (assert (= *count1
* 5)))
51 ;;; Friendlier superclass order test case
52 (defclass sub-generic-function2
(super-funcallable-mixin
53 standard-generic-function
) ()
54 (:metaclass sb-mop
:funcallable-standard-class
))
56 (defclass sub-method2
(standard-method) ())
58 (defgeneric myfun2
(a b
)
59 (:generic-function-class sub-generic-function2
)
60 (:method-class sub-method2
))
64 (defmethod myfun2 (a b
)
67 (with-test (:name
(:mop-13
3))
69 (assert (= *count2
* 1))
71 (assert (= *count2
* 2)))
73 (defmethod myfun2 ((a integer
) (b integer
))
76 (with-test (:name
(:mop-13
4))
78 (assert (= *count2
* 4))
80 (assert (= *count2
* 5)))