1.0.4.12: stale bugs
[sbcl/lichteblau.git] / tests / mop-8.impure-cload.lisp
blobe20ace4cc34946bb3925ea85fd1550c5b035e18b
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 contains tests of UPDATE-DEPENDENT.
16 (defpackage "MOP-8"
17 (:use "CL" "SB-MOP" "TEST-UTIL"))
19 (in-package "MOP-8")
21 (defclass dependent-history ()
22 ((history :initarg :history :accessor history)))
24 (defmethod update-dependent ((generic-function generic-function)
25 (history dependent-history)
26 &rest args)
27 (push args (history history)))
28 (defmethod update-dependent ((class class)
29 (history dependent-history)
30 &rest args)
31 (push (cons class args) (history history)))
33 (defvar *history* (make-instance 'dependent-history :history nil))
35 (defgeneric upd1 (x))
36 (add-dependent #'upd1 *history*)
37 (defmethod upd1 ((x integer)) x)
38 (let ((last (car (history *history*))))
39 (assert (eq (car last) 'add-method))
40 (assert (typep (cadr last) 'standard-method)))
42 (defclass foo ()
43 ())
44 (add-dependent (find-class 'foo) *history*)
45 (defclass foo ()
46 ((a :initarg :a)))
47 (let ((last (car (history *history*))))
48 (assert (eq (car last) (find-class 'foo))))