Fix make-array transforms.
[sbcl.git] / tests / mop-10.impure-cload.lisp
1 ;;;; miscellaneous side-effectful tests of the MOP
2
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.
13
14 ;;; this file contains tests of REINITIALIZE-INSTANCE on generic
15 ;;; functions.
16
17 (defpackage "MOP-10"
18   (:use "CL" "SB-MOP" "TEST-UTIL"))
19
20 (in-package "MOP-10")
21
22 (defclass my-generic-function (standard-generic-function)
23   ()
24   (:metaclass funcallable-standard-class))
25
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))
32
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))))