194 |
(eqt x y)))) |
(eqt x y)))) |
195 |
(A . 3)) |
(A . 3)) |
196 |
|
|
197 |
(deftest assoc-26 |
;;; Keyword tests |
198 |
|
|
199 |
|
(deftest assoc.allow-other-keys.1 |
200 |
(assoc 'b '((a . 1) (b . 2) (c . 3)) :bad t :allow-other-keys t) |
(assoc 'b '((a . 1) (b . 2) (c . 3)) :bad t :allow-other-keys t) |
201 |
(b . 2)) |
(b . 2)) |
202 |
|
|
203 |
(deftest assoc-27 |
(deftest assoc.allow-other-keys.2 |
204 |
(assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys t :also-bad t) |
(assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys t :also-bad t) |
205 |
(b . 2)) |
(b . 2)) |
206 |
|
|
207 |
(deftest assoc-28 |
(deftest assoc.allow-other-keys.3 |
208 |
(assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys t :also-bad t |
(assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys t :also-bad t |
209 |
:test-not #'eql) |
:test-not #'eql) |
210 |
(a . 1)) |
(a . 1)) |
211 |
|
|
212 |
|
(deftest assoc.allow-other-keys.4 |
213 |
|
(assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys t) |
214 |
|
(b . 2)) |
215 |
|
|
216 |
|
(deftest assoc.allow-other-keys.5 |
217 |
|
(assoc 'b '((a . 1) (b . 2) (c . 3)) :allow-other-keys nil) |
218 |
|
(b . 2)) |
219 |
|
|
220 |
|
(deftest assoc.keywords.6 |
221 |
|
(assoc 'b '((a . 1) (b . 2) (c . 3)) :key #'identity :key #'null) |
222 |
|
(b . 2)) |
223 |
|
|
224 |
|
(deftest assoc.keywords.7 |
225 |
|
(assoc 'b '((a . 1) (b . 2) (c . 3)) :key nil :key #'null) |
226 |
|
(b . 2)) |
227 |
|
|
228 |
|
|
229 |
(deftest assoc.error.1 |
(deftest assoc.error.1 |
230 |
(classify-error (assoc)) |
(classify-error (assoc)) |
231 |
program-error) |
program-error) |
287 |
(assoc-if #'null '((a . b) nil (c . d) (nil . e) (f . g))) |
(assoc-if #'null '((a . b) nil (c . d) (nil . e) (f . g))) |
288 |
(nil . e)) |
(nil . e)) |
289 |
|
|
290 |
(deftest assoc-if-5 |
;;; Keyword tests |
291 |
|
|
292 |
|
(deftest assoc-if.allow-other-keys.1 |
293 |
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :bad t :allow-other-keys t) |
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :bad t :allow-other-keys t) |
294 |
(nil . 2)) |
(nil . 2)) |
295 |
|
|
296 |
(deftest assoc-if-6 |
(deftest assoc-if.allow-other-keys.2 |
297 |
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) |
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) |
298 |
:allow-other-keys t :also-bad t) |
:allow-other-keys t :also-bad t) |
299 |
(nil . 2)) |
(nil . 2)) |
300 |
|
|
301 |
(deftest assoc-if-7 |
(deftest assoc-if.allow-other-keys.3 |
302 |
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) |
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) |
303 |
:allow-other-keys t :also-bad t :key #'not) |
:allow-other-keys t :also-bad t :key #'not) |
304 |
(a . 1)) |
(a . 1)) |
305 |
|
|
306 |
|
(deftest assoc-if.allow-other-keys.4 |
307 |
|
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :allow-other-keys t) |
308 |
|
(nil . 2)) |
309 |
|
|
310 |
|
(deftest assoc-if.allow-other-keys.5 |
311 |
|
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :allow-other-keys nil) |
312 |
|
(nil . 2)) |
313 |
|
|
314 |
|
(deftest assoc-if.keywords.6 |
315 |
|
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :key #'identity :key #'null) |
316 |
|
(nil . 2)) |
317 |
|
|
318 |
|
(deftest assoc-if.keywords.7 |
319 |
|
(assoc-if #'null '((a . 1) (nil . 2) (c . 3)) :key nil :key #'null) |
320 |
|
(nil . 2)) |
321 |
|
|
322 |
;;; Error cases |
;;; Error cases |
323 |
|
|
324 |
(deftest assoc-if.error.1 |
(deftest assoc-if.error.1 |
382 |
(assoc-if-not #'identity '((a . b) nil (c . d) (nil . e) (f . g))) |
(assoc-if-not #'identity '((a . b) nil (c . d) (nil . e) (f . g))) |
383 |
(nil . e)) |
(nil . e)) |
384 |
|
|
385 |
(deftest assoc-if-not-5 |
;;; Keyword tests |
386 |
|
|
387 |
|
(deftest assoc-if-not.allow-other-keys.1 |
388 |
(assoc-if-not #'identity |
(assoc-if-not #'identity |
389 |
'((a . 1) (nil . 2) (c . 3)) :bad t :allow-other-keys t) |
'((a . 1) (nil . 2) (c . 3)) :bad t :allow-other-keys t) |
390 |
(nil . 2)) |
(nil . 2)) |
391 |
|
|
392 |
(deftest assoc-if-not-6 |
(deftest assoc-if-not.allow-other-keys.2 |
393 |
(assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) |
(assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) |
394 |
:allow-other-keys t :also-bad t) |
:allow-other-keys t :also-bad t) |
395 |
(nil . 2)) |
(nil . 2)) |
396 |
|
|
397 |
(deftest assoc-if-not-7 |
(deftest assoc-if-not.allow-other-keys.3 |
398 |
(assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) |
(assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) |
399 |
:allow-other-keys t :also-bad t :key #'not) |
:allow-other-keys t :also-bad t :key #'not) |
400 |
(a . 1)) |
(a . 1)) |
401 |
|
|
402 |
|
(deftest assoc-if-not.allow-other-keys.4 |
403 |
|
(assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) :allow-other-keys t) |
404 |
|
(nil . 2)) |
405 |
|
|
406 |
|
(deftest assoc-if-not.allow-other-keys.5 |
407 |
|
(assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) :allow-other-keys nil) |
408 |
|
(nil . 2)) |
409 |
|
|
410 |
|
(deftest assoc-if-not.keywords.6 |
411 |
|
(assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) |
412 |
|
:key #'identity :key #'null) |
413 |
|
(nil . 2)) |
414 |
|
|
415 |
|
(deftest assoc-if-not.keywords.7 |
416 |
|
(assoc-if-not #'identity '((a . 1) (nil . 2) (c . 3)) :key nil :key #'null) |
417 |
|
(nil . 2)) |
418 |
|
|
419 |
|
;;; Error tests |
420 |
|
|
421 |
(deftest assoc-if-not.error.1 |
(deftest assoc-if-not.error.1 |
422 |
(classify-error (assoc-if-not)) |
(classify-error (assoc-if-not)) |
423 |
program-error) |
program-error) |