1 ;;;; side-effect-free tests of the condition system
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
)
16 ;;; Until 0.7.7.21, (MAKE-CONDITION 'FILE-ERROR :PATHNAME "FOO")
17 ;;; wasn't printable, because the REPORT function for FILE-ERROR
18 ;;; referred to unbound slots. This was reported and fixed by Antonio
19 ;;; Martinez (sbcl-devel 2002-09-10).
21 "~&printable now: ~A~%"
22 (make-condition 'file-error
:pathname
"foo"))
26 (macrolet ((opaque-error (arg) `(error ,arg
)))
29 (let ((restarts (remove 'res
(compute-restarts c
)
32 (assert (= (length restarts
) 2))
33 (invoke-restart (second restarts
))))))
34 (let ((foo1 (make-condition 'error
))
35 (foo2 (make-condition 'error
)))
37 (with-condition-restarts foo1
(list (find-restart 'res
))
47 (macrolet ((opaque-error (arg) `(error ,arg
)))
48 (let ((foo1 (make-condition 'error
))
49 (foo2 (make-condition 'error
)))
52 (let ((restarts (remove 'res
(compute-restarts foo1
)
55 (assert (= (length restarts
) 1))
56 (invoke-restart (first restarts
))))))
58 (with-condition-restarts foo1
(list (find-restart 'res
))
70 (c1 (make-condition 'error
))
71 (c2 (make-condition 'error
)))
76 (flet ((check-restarts (length)
78 (length (remove 'foo
(compute-restarts c1
)
84 (invoke-restart (find-restart 'foo c1
))))))
89 (foo () :test
(lambda (c) (declare (ignore c
)) visible
)