X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcondition.pure.lisp;h=cddc4be1227413119d980379093dd3f4ec0c6fc6;hb=3d2929a8f013c3a35ea4fcf46426031cbb8b0953;hp=310562d85479fb0d462738d5899a4136889743a9;hpb=b72f483c96c09a775515af0104e3be831261ae36;p=sbcl.git diff --git a/tests/condition.pure.lisp b/tests/condition.pure.lisp index 310562d..cddc4be 100644 --- a/tests/condition.pure.lisp +++ b/tests/condition.pure.lisp @@ -122,3 +122,32 @@ (subtypep 'fixnum (type-error-expected-type c)))) (assert (eq (type-error-datum c) t))) (:no-error (&rest rest) (error "no error: ~S" rest))) + +;;; ANSI specifies TYPE-ERROR if datum and arguments of ERROR are not +;;; designators for a condition. Reported by Bruno Haible on cmucl-imp +;;; 2004-10-12. +(flet ((test (&rest args) + (multiple-value-bind (res err) + (ignore-errors (apply #'error args)) + (assert (not res)) + (assert (typep err 'type-error)) + (assert (not (nth-value 1 (ignore-errors + (type-error-datum err))))) + (assert (not (nth-value 1 (ignore-errors + (type-error-expected-type err)))))))) + (test '#:no-such-condition) + (test nil) + (test t) + (test 42) + (test (make-instance 'standard-object))) + +;;; If CERROR is given a condition, any remaining arguments are only +;;; used for the continue format control. +(let ((x 0)) + (handler-bind + ((simple-error (lambda (c) (incf x) (continue c)))) + (cerror "Continue from ~A at ~A" + (make-condition 'simple-error :format-control "foo" + :format-arguments nil) + 'cerror (get-universal-time)) + (assert (= x 1))))