source: trunk/source/tests/ansi-tests/make-instances-obsolete.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat May 17 08:12:35 2003
4;;;; Contains: Tests of MAKE-INSTANCES-OBSOLETE
5
6(in-package :cl-test)
7
8(defclass make-instances-obsolete-class-01 ()
9  ((a :initarg :a)
10   (b :initarg :b :allocation :class)
11   (c :initarg :c :initform 'abc)
12   (d :initarg :d :type fixnum :initform 0)))
13
14(deftest make-instances-obsolete.1
15  (let* ((class-designator 'make-instances-obsolete-class-01)
16         (class (find-class class-designator))
17         (obj (make-instance class :a 'x :b 'y :c 'z :d 17)))
18    (values
19     (eqt (class-of obj) class)
20     (map-slot-value obj '(a b c d))
21     (let ((val (make-instances-obsolete class)))
22       (or (eqt val class-designator)
23           (eqt val class)))
24     (map-slot-value obj '(a b c d))))
25  t (x y z 17) t (x y z 17))
26
27(deftest make-instances-obsolete.2
28  (let* ((class-designator 'make-instances-obsolete-class-01)
29         (class (find-class class-designator))
30         (obj (make-instance class :a 'x :b 'y :c 'z :d 17)))
31    (values
32     (eqt (class-of obj) class)
33     (map-slot-value obj '(a b c d))
34     (let ((val (make-instances-obsolete class-designator)))
35       (or (eqt val class-designator)
36           (eqt val class)))
37     (map-slot-value obj '(a b c d))))
38  t (x y z 17) t (x y z 17))
39
40;;; Error cases
41
42(deftest make-instances-obsolete.error.1
43  (signals-error (make-instances-obsolete) program-error)
44  t)
45
46(deftest make-instances-obsolete.error.2
47  (signals-error (make-instances-obsolete
48                   (find-class 'make-instances-obsolete-class-01)
49                   nil)
50                 program-error)
51  t)
Note: See TracBrowser for help on using the repository browser.