Browse files

Improved ensure-cases macro to allow it to break on problems

Improved ensure-cases so that it takes *break-on-errors?* and
*break-on-failures?* into account. This makes debugging some
test problems much easier.
  • Loading branch information...
1 parent ee7851c commit 16cc4e3834df22ee36b310f63f72e7e4f8bf1568 Gary King committed Feb 12, 2011
Showing with 14 additions and 3 deletions.
  1. +14 −3 dev/macros.lisp
17 dev/macros.lisp
@@ -470,11 +470,21 @@ is generated instead of a warning"
(cancel-testing :interrupt)))
(lambda (condition)
- (push (list ,case condition) ,errors)
- (go :continue))))
+ (let ((*in-middle-of-failure?* nil))
+ (push (list ,case condition) ,errors)
+ (when (and *test-break-on-errors?*
+ (not (test-case-expects-error-p
+ *current-testsuite-name* *current-test-case-name*)))
+ (invoke-debugger condition))
+ (go :continue)))))
(progn ,@body))
(ensure-failed (cond)
- (push (list ,case cond) ,problems))))
+ (push (list ,case cond) ,problems)
+ (when (and *test-break-on-failures?*
+ (not (test-case-expects-failure-p
+ *current-testsuite-name* *current-test-case-name*)))
+ (let ((*in-middle-of-failure?* nil))
+ (invoke-debugger cond))))))
(if (or ,problems ,errors)
(let ((condition (make-condition
@@ -488,6 +498,7 @@ is generated instead of a warning"
;; return true if we're happy
(defmacro ensure-member
(form values &key (test nil test-specified-p)

0 comments on commit 16cc4e3

Please sign in to comment.