Skip to content

Commit

Permalink
Update check-raise-value
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfirth committed Sep 9, 2017
1 parent 81075ed commit fabfad0
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions rackunit-lib/rackunit/meta.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,10 @@
;; Extracting raised values from checks

(define (check-raise-value chk-thnk)
;; To fully isolate the evaluation of a check inside another check,
;; we have to ensure that 1) the inner check raises its failure normally
;; instead of writing to stdout / stderr, 2) the inner check doesn't log
;; any pass or fail information to rackunit/log, and 3) the inner check's info
;; stack is independent of the outer check's info stack.
(or (parameterize ([current-check-handler raise]
[test-log-enabled? #f]
[current-check-info (list)])
;; Checks called inside other checks raise their values normally and don't
;; log test failures, so all we have to do is ensure the check is executed
;; with an info stack that is independent of the outer check.
(or (parameterize ([current-check-info (list)])
(with-handlers ([(negate exn:break?) values]) (chk-thnk) #f))
(fail-check "Check passed unexpectedly")))

Expand Down

0 comments on commit fabfad0

Please sign in to comment.