source: trunk/source/tests/ansi-tests/defclass-errors.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: 4.0 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Fri Apr 25 06:59:22 2003
4;;;; Contains: Error case tests for DEFCLASS
5
6(in-package :cl-test)
7
8;;; I created some redundant tests by accident.  This list of
9;;; tests could be reduced in size.
10
11(deftest defclass.error.1
12  (signals-error
13   (defclass erroneous-class.1 ()
14     (a b c d b e))
15   program-error)
16  t)
17
18(deftest defclass.error.2
19  (signals-error
20   (defclass erroneous-class.2 ()
21     ((s1 :initarg :foo))
22     (:default-initargs :foo 1 :foo 2))
23   program-error)
24  t)
25
26(deftest defclass.error.3
27  (signals-error
28   (defclass erroneous-class.3 ()
29     ((s1 :initform 0 :initform 2)))
30   program-error)
31  t)
32
33(deftest defclass.error.4
34  (signals-error
35   (defclass erroneous-class.4 ()
36     ((s1 :initform 0 :initform 0)))
37   program-error)
38  t)
39
40(deftest defclass.error.5
41  (signals-error
42   (defclass erroneous-class.5 ()
43     ((s1 :type fixnum :type character)))
44   program-error)
45  t)
46
47(deftest defclass.error.6
48  (signals-error
49   (defclass erroneous-class.6 ()
50     ((s1 :type t :type t)))
51   program-error)
52  t)
53
54(deftest defclass.error.7
55  (signals-error
56   (defclass erroneous-class.7 ()
57     ((s1 :documentation "foo" :documentation "bar")))
58   program-error)
59  t)
60
61(deftest defclass.error.8
62  (signals-error
63   (defclass erroneous-class.8 ()
64     ((s1 :documentation #1="foo" :documentation #1#)))
65   program-error)
66  t)
67
68(deftest defclass.error.9
69  (signals-error
70   (defclass erroneous-class.9 ()
71     ((s1 :allocation :class :allocation :instance)))
72   program-error)
73  t)
74
75(deftest defclass.error.10
76  (signals-error
77   (defclass erroneous-class.10 ()
78     ((s1 :allocation :class :allocation :class)))
79   program-error)
80  t)
81
82(deftest defclass.error.11
83  (signals-error
84   (defclass erroneous-class.11 ()
85     ((s1 :allocation :instance :allocation :instance)))
86   program-error)
87  t)
88
89(deftest defclass.error.12
90  (signals-error
91   (defclass erroneous-class.12 ()
92     ((s1 #.(gensym) nil)))
93   program-error)
94  t)
95
96(deftest defclass.error.13
97  (signals-error
98   (defclass erroneous-class.13 ()
99     (a b c)
100     (#.(gensym)))
101   program-error)
102  t)
103
104(deftest defclass.error.14
105  (signals-error
106   (defclass defclass-error-14 nil
107     (foo foo))
108   program-error)
109  t)
110
111(deftest defclass.error.15
112  (signals-error
113   (defclass defclass-error-15 nil
114     (foo (foo)))
115   program-error)
116  t)
117
118(deftest defclass.error.16
119  (signals-error
120   (defclass defclass-error-16 nil
121     ((foo :initarg f1))
122     (:default-initargs :f1 10 :f1 20))
123   program-error)
124  t)
125
126(deftest defclass.error.17
127  (signals-error
128   (defclass defclass-error-17 nil
129     ((foo :initform 10 :initform 20 :reader defclass-error-4/foo)))
130   program-error)
131  t)
132
133(deftest defclass.error.18
134  (signals-error
135   (defclass defclass-error-18 nil
136     ((foo :initform 10 :initform 10 :reader defclass-error-5/foo)))
137   program-error)
138  t)
139
140(deftest defclass.error.19
141  (signals-error
142   (defclass defclass-error-19 nil
143     ((foo :initarg f1 :type t :type t :reader defclass-error-6/foo)))
144   program-error)
145  t)
146
147(deftest defclass.error.20
148  (signals-error
149   (defclass defclass-error-20 nil
150     ((foo :initarg f1 :documentation "x" :reader defclass-error-7/foo
151           :documentation "x")))
152   program-error)
153  t)
154
155(deftest defclass.error.21
156  (signals-error
157   (defclass defclass-error-21 ()
158     ((foo #:unknown-slot-option nil)))
159   program-error)
160  t)
161
162(deftest defclass.error.22
163  (let ((option (gentemp "UNKNOWN-OPTION" (symbol-package :foo))))
164    (eval
165     `(signals-error
166       (defclass defclass-error-22 ()
167         (foo bar)
168         (,option nil))
169       program-error)))
170  t)
171
172(deftest defclass.error.23
173  (loop for cl in *built-in-classes*
174        for name = (class-name cl)
175        unless (or (not name)
176                   (handler-case
177                    (progn (eval `(defclass ,(gensym) (,name))) nil)
178                    (error (c) c)))
179        collect (list cl name))
180  nil)
181
182(deftest defclass.error.24
183  (loop for cl in *built-in-classes*
184        for name = (class-name cl)
185        unless (or (not name)
186                   (handler-case
187                    (progn (eval `(defclass ,name ())) nil)
188                    (error (c) c)))
189        collect (list cl name))
190  nil)
191
Note: See TracBrowser for help on using the repository browser.