(foo () :test (lambda (c) (declare (ignore c)) visible)
'in2))
(foo () 'ext)))))))
+
+;;; First argument of CERROR is a format control
+(assert
+ (eq (block nil
+ (handler-bind
+ ((type-error (lambda (c) (return :failed)))
+ (simple-error (lambda (c)
+ (return (if (find-restart 'continue)
+ :passed
+ :failed)))))
+ (cerror (formatter "Continue from ~A") "bug ~A" :bug)))
+ :passed))
+
+;;; clauses in HANDLER-CASE are allowed to have declarations (and
+;;; indeed, only declarations)
+(assert
+ (null (handler-case (error "foo") (error () (declare (optimize speed))))))
+
+(handler-case
+ (handler-bind ((warning #'muffle-warning))
+ (signal 'warning))
+ ;; if it's a control error, it had better be printable
+ (control-error (c) (format nil "~A" c))
+ ;; there had better be an error
+ (:no-error (&rest args) (error "No error: ~S" args)))
+
+(handler-case
+ (funcall (lambda (x) (check-type x fixnum) x) t)
+ (type-error (c)
+ (assert (and (subtypep (type-error-expected-type c) 'fixnum)
+ (subtypep 'fixnum (type-error-expected-type c))))
+ (assert (eq (type-error-datum c) t)))
+ (:no-error (&rest rest) (error "no error: ~S" rest)))