Commit 460acc57 authored by pfdietz's avatar pfdietz

Add check that eval of unbound variable gives an unbound-variable condition...

Add check that eval of unbound variable gives an unbound-variable condition with the appropriate name.  Also check the condition from MAKUNBOUND
parent 68a1c703
......@@ -272,7 +272,7 @@ the condition to go uncaught if it cannot be classified."
;;; The above is badly designed, since it fails when some signals
;;; may be in more than one class/
(defmacro signals-error (form error-name &key (safety 3) name)
(defmacro signals-error (form error-name &key (safety 3) (name nil name-p))
`(handler-bind
((warning #'(lambda (c) (declare (ignore c))
(muffle-warning))))
......@@ -299,13 +299,14 @@ the condition to go uncaught if it cannot be classified."
(type-error-expected-type c)))
"==> true"))))
nil)
,@(if (eq error-name 'undefined-function)
,@(if (and name-p (member error-name '(undefined-function
unbound-variable)))
`(((not (eq (cell-error-name c) ',name))
(values
nil
(list 'cell-error-name "==>"
(cell-error-name c)))))
nil)
nil)
(t (printable-p c)))))))
(defmacro signals-error-always (form error-name)
......
......@@ -51,3 +51,8 @@
(eval `(signals-error (eval (list ',v)) undefined-function
:name ,v)))
t)
(deftest eval.error.4
(let ((v (gensym)))
(eval `(signals-error (eval ',v) unbound-variable :name ,v)))
t)
\ No newline at end of file
......@@ -25,7 +25,9 @@
(equalt (multiple-value-list (makunbound sym)) (list sym))
(boundp sym)
(handler-case (symbol-value sym)
(unbound-variable () :good))))
(unbound-variable (c)
(if (eq (cell-error-name c) sym) :good
(list :bad sym (cell-error-name c)))))))
nil :foo t nil :good)
;;; Error cases
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment