1 ;;;; tests of the CASE family of macros without side effects
3 ;;;; This software is part of the SBCL system. See the README file for
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
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.
14 (cl:in-package
:cl-user
)
17 for
(expected kind . clauses
) in
22 ("Duplicate key 1 in CASE form, occurring in the first clause: (1 1), and the second clause: (1 2)"
25 ("Duplicate key 2 in CASE form, occurring in the first clause: ((1 2) 1), and the second clause: ((2 3) 2)"
31 for form
= `(lambda ()
35 (multiple-value-bind (fun warnings-p failure-p
)
36 (handler-bind ((style-warning (lambda (c)
38 (assert (search expected
39 (with-standard-io-syntax
40 (let ((*print-right-margin
* nil
)
42 (remove #\Newline
(princ-to-string c
)))))
44 "~S should have warned ~S, but instead warned: ~A" form expected c
)
45 (error "~S shouldn't give a warning, but did: ~A" form c
))
46 (setf expected nil
))))
48 (declare (ignore warnings-p
))
49 (assert (functionp fun
))
50 (assert (null expected
)
52 "~S should have warned ~S, but didn't."
54 (assert (not failure-p
))))
56 (with-test (:name
:duplicate-cases-load
)
57 (assert (load "case-test.lisp")))