alien.impure: compile a test.
[sbcl.git] / tests / mop-15.impure-cload.lisp
blob7be745ce7f7b60b6bcd69e7725d0d774b9423500
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 tests that FINALIZE-INHERITANCE behaves intuitively:
15 ;;; that when FINALIZE-INHERITANCE is called on a class, it returns
16 ;;; before subclasses are finalized.
18 (defpackage "MOP-15"
19 (:use "CL" "SB-MOP"))
21 (in-package "MOP-15")
23 (defclass mop-15-class (standard-class) ())
25 (defmethod validate-superclass ((s mop-15-class) (super standard-class))
28 (defvar *count* 0)
29 (defvar *max-count* 0)
31 (defmethod finalize-inheritance ((c mop-15-class))
32 (let ((*count* (1+ *count*)))
33 (when (> *count* *max-count*)
34 (setf *max-count* *count*))
35 (call-next-method)))
37 (defclass sub (super)
39 (:metaclass mop-15-class))
41 (defclass super ()
43 (:metaclass mop-15-class))
45 (finalize-inheritance (find-class 'super))
46 (finalize-inheritance (find-class 'sub))
48 (assert (= *max-count* 1))