1.0.19.30: muffle code deletion note from destructuring-bind
[sbcl/pkhuong.git] / tests / mop-12.impure-cload.lisp
blobf39915bf1eb1807216271ef1aeb020e252419827
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 file attempts to test possible metacircularity issues arising
15 ;;; from adding slots to methods in odd places.
17 (defpackage "MOP-12"
18 (:use "CL" "SB-MOP"))
20 (in-package "MOP-12")
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))
35 (defvar *count1* 0)
37 (defmethod myfun1 (a b)
38 (incf *count1*))
40 (myfun1 2 3)
41 (assert (= *count1* 1))
42 (myfun1 t nil)
43 (assert (= *count1* 2))
45 (defmethod myfun1 ((a integer) (b integer))
46 (incf *count1* 2))
48 (myfun1 2 3)
49 (assert (= *count1* 4))
50 (myfun1 t nil)
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))
64 (defvar *count2* 0)
66 (defmethod myfun2 (a b)
67 (incf *count2*))
69 (myfun2 2 3)
70 (assert (= *count2* 1))
71 (myfun2 t nil)
72 (assert (= *count2* 2))
74 (defmethod myfun2 ((a integer) (b integer))
75 (incf *count2* 2))
77 (myfun2 2 3)
78 (assert (= *count2* 4))
79 (myfun2 t nil)
80 (assert (= *count2* 5))