grovel-headers.c: Put win32 stuff into grovel-headers-win32.h.
[sbcl.git] / tests / mop-10.impure-cload.lisp
blob26cdd72de8d005cba48df0a525554757adabd6b1
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 REINITIALIZE-INSTANCE on generic
15 ;;; functions.
17 (defpackage "MOP-10"
18 (:use "CL" "SB-MOP" "TEST-UTIL"))
20 (in-package "MOP-10")
22 (defclass my-generic-function (standard-generic-function)
24 (:metaclass funcallable-standard-class))
26 (defgeneric foo (x)
27 (:method-combination list)
28 (:method list ((x float)) (* x x))
29 (:method list ((x integer)) (1+ x))
30 (:method list ((x number)) (expt x 2))
31 (:generic-function-class my-generic-function))
33 (assert (equal (foo 3) '(4 9)))
34 (defmethod compute-discriminating-function ((gf my-generic-function))
35 (let ((orig (call-next-method)))
36 (lambda (&rest args)
37 (let ((orig-result (apply orig args)))
38 (cons gf (reverse orig-result))))))
39 (assert (equal (foo 3) '(4 9)))
40 (reinitialize-instance #'foo)
41 (assert (equal (foo 3) (cons #'foo '(9 4))))