X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fcondition.pure.lisp;h=d40cdbac73294504bc7682fa561609a9882c6027;hb=15d6e7c9a2c3234f95dfe278046fa2fee1b0c007;hp=0a4dd84575f0371eb5b2c7aeb05190a626741093;hpb=b1bc2f2142b25964c60d8a295afe1ecf289cd0c8;p=sbcl.git diff --git a/tests/condition.pure.lisp b/tests/condition.pure.lisp index 0a4dd84..d40cdba 100644 --- a/tests/condition.pure.lisp +++ b/tests/condition.pure.lisp @@ -114,3 +114,26 @@ (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))) + +;;; 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))))) + (test '#:no-such-condition) + (test nil) + (test t) + (test 42) + (test (make-instance 'standard-object))) +