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 contains tests of UPDATE-DEPENDENT.
17 (:use
"CL" "SB-MOP" "TEST-UTIL"))
21 (defclass dependent-history
()
22 ((history :initarg
:history
:accessor history
)))
24 (defmethod update-dependent ((generic-function generic-function
)
25 (history dependent-history
)
27 (push args
(history history
)))
28 (defmethod update-dependent ((class class
)
29 (history dependent-history
)
31 (push (cons class args
) (history history
)))
33 (defvar *history
* (make-instance 'dependent-history
:history nil
))
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
)))
44 (add-dependent (find-class 'foo
) *history
*)
47 (let ((last (car (history *history
*))))
48 (assert (eq (car last
) (find-class 'foo
))))