103 |
|
|
104 |
;; Error checking |
;; Error checking |
105 |
|
|
106 |
(deftest ldiff-7 |
(deftest ldiff.error.1 |
107 |
(catch-type-error (ldiff 10 'a)) |
(catch-type-error (ldiff 10 'a)) |
108 |
type-error) |
type-error) |
109 |
|
|
110 |
;; Single atoms are not dotted lists, so the next |
;; Single atoms are not dotted lists, so the next |
111 |
;; case should be a type-error |
;; case should be a type-error |
112 |
(deftest ldiff-8 |
(deftest ldiff.error.2 |
113 |
(catch-type-error (ldiff 'a 'a)) |
(catch-type-error (ldiff 'a 'a)) |
114 |
type-error) |
type-error) |
115 |
|
|
116 |
(deftest ldiff-9 |
(deftest ldiff.error.3 |
117 |
(catch-type-error (ldiff (make-array '(10) :initial-element 'a) '(a))) |
(catch-type-error (ldiff (make-array '(10) :initial-element 'a) '(a))) |
118 |
type-error) |
type-error) |
119 |
|
|
120 |
(deftest ldiff-10 |
(deftest ldiff.error.4 |
121 |
(catch-type-error (ldiff 1.23 t)) |
(catch-type-error (ldiff 1.23 t)) |
122 |
type-error) |
type-error) |
123 |
|
|
124 |
(deftest ldiff-11 |
(deftest ldiff.error.5 |
125 |
(catch-type-error (ldiff #\w 'a)) |
(catch-type-error (ldiff #\w 'a)) |
126 |
type-error) |
type-error) |
127 |
|
|
128 |
|
(deftest ldiff.error.6 |
129 |
|
(classify-error (ldiff)) |
130 |
|
program-error) |
131 |
|
|
132 |
|
(deftest ldiff.error.7 |
133 |
|
(classify-error (ldiff nil)) |
134 |
|
program-error) |
135 |
|
|
136 |
|
(deftest ldiff.error.8 |
137 |
|
(classify-error (ldiff nil nil nil)) |
138 |
|
program-error) |
139 |
|
|
140 |
;; Note! The spec is ambiguous on whether this next test |
;; Note! The spec is ambiguous on whether this next test |
141 |
;; is correct. The spec says that ldiff should be prepared |
;; is correct. The spec says that ldiff should be prepared |
142 |
;; to signal an error if the list argument is not a proper |
;; to signal an error if the list argument is not a proper |
177 |
;; The next four tests test that tailp handles dotted lists. See |
;; The next four tests test that tailp handles dotted lists. See |
178 |
;; TAILP-NIL:T in the X3J13 documentation. |
;; TAILP-NIL:T in the X3J13 documentation. |
179 |
|
|
180 |
(deftest tailp-2 |
(deftest tailp.error.1 |
181 |
(catch-type-error (not (not (tailp 'e (copy-tree '(a b c d . e)))))) |
(catch-type-error (not (not (tailp 'e (copy-tree '(a b c d . e)))))) |
182 |
t) |
t) |
183 |
|
|
184 |
(deftest tailp-3 |
(deftest tailp.error.2 |
185 |
(catch-type-error (tailp 'z (copy-tree '(a b c d . e)))) |
(catch-type-error (tailp 'z (copy-tree '(a b c d . e)))) |
186 |
nil) |
nil) |
187 |
|
|
188 |
(deftest tailp-4 |
(deftest tailp.error.3 |
189 |
(catch-type-error (not (not (tailp 10203040506070 |
(catch-type-error (not (not (tailp 10203040506070 |
190 |
(list* 'a 'b (1- 10203040506071)))))) |
(list* 'a 'b (1- 10203040506071)))))) |
191 |
t) |
t) |
192 |
|
|
193 |
(deftest tailp-5 |
(deftest tailp.error.4 |
194 |
(let ((x "abcde")) |
(let ((x "abcde")) |
195 |
(catch-type-error (tailp x |
(catch-type-error (tailp x (list* 'a 'b (copy-seq x))))) |
|
(list* 'a 'b (copy-seq x))))) |
|
196 |
nil) |
nil) |
197 |
|
|
198 |
|
(deftest tailp.error.5 |
199 |
|
(classify-error (tailp)) |
200 |
|
program-error) |
201 |
|
|
202 |
|
(deftest tailp.error.6 |
203 |
|
(classify-error (tailp nil)) |
204 |
|
program-error) |
205 |
|
|
206 |
|
(deftest tailp.error.7 |
207 |
|
(classify-error (tailp nil nil nil)) |
208 |
|
program-error) |
209 |
|
|
210 |
;; Test that tailp does not modify its arguments |
;; Test that tailp does not modify its arguments |
211 |
|
|
212 |
(deftest tailp-6 |
(deftest tailp-6 |
220 |
(check-scaffold-copy y ycopy)))) |
(check-scaffold-copy y ycopy)))) |
221 |
t) |
t) |
222 |
|
|
|
;; Error checking |
|
|
|
|
223 |
;; Note! The spec is ambiguous on whether this next test |
;; Note! The spec is ambiguous on whether this next test |
224 |
;; is correct. The spec says that tailp should be prepared |
;; is correct. The spec says that tailp should be prepared |
225 |
;; to signal an error if the list argument is not a proper |
;; to signal an error if the list argument is not a proper |