From: Marco Baringer Date: Tue, 26 Jun 2007 10:54:43 +0000 (+0200) Subject: Avoid dobule evaluation of IS-FALSE's argument X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=325262d82eb9620b042e4c2bad38eb5dd47c03ef;p=fiveam.git Avoid dobule evaluation of IS-FALSE's argument --- diff --git a/src/check.lisp b/src/check.lisp index c2f4ee7..cdf57fd 100644 --- a/src/check.lisp +++ b/src/check.lisp @@ -229,13 +229,16 @@ REASON-ARGS is provided, is generated based on the form of TEST: failure otherwise. Like IS-TRUE, and unlike IS, IS-FALSE does not inspect CONDITION to determine what reason to give it case of test failure" - `(if ,condition - (process-failure - :reason ,(if reason-args - `(format nil ,@reason-args) - `(format nil "~S returned a true value" ',condition)) - :test-expr ',condition) - (add-result 'test-passed :test-expr ',condition))) + + (with-unique-names (value) + `(let ((,value ,condition)) + (if ,value + (process-failure + :reason ,(if reason-args + `(format nil ,@reason-args) + `(format nil "~S returned the value ~S, which is true" ',condition ,value )) + :test-expr ',condition) + (add-result 'test-passed :test-expr ',condition))))) (defmacro signals (condition-spec &body body)