Make check-exn/check-not-exn keep the check failure message.

original commit: ad6365f34c422d5d4999d882a2641d7d833ca07b
This commit is contained in:
Eric Dobson 2014-03-08 16:27:03 -08:00
commit 2a224fa511
2 changed files with 28 additions and 2 deletions

View File

@ -98,12 +98,12 @@
;; refail-check : exn:test:check -> (exception raised)
;;
;; Raises an exn:test:check with the contents of the
;; given parameter. Useful for propogating internal
;; given exception. Useful for propogating internal
;; errors to the outside world.
(define (refail-check exn)
(test-log! #f)
(raise
(make-exn:test:check "Check failure"
(make-exn:test:check (exn-message exn)
(exn-continuation-marks exn)
(exn:test:check-stack exn))))

View File

@ -317,6 +317,32 @@
#t
found?))
#f names))))
(test-case
"check-exn has check failure message"
(let* ([case (delay-test
(test-case "check-exn"
(check-exn #rx"ZZZZZ"
(lambda () (fail-check "The Message")))))]
[result (test-failure-result (car (run-test case)))]
[names (map check-info-name
(exn:test:check-stack result))])
(check-equal?
"The Message"
(exn-message result))))
(test-case
"check-not-exn has check failure message"
(let* ([case (delay-test
(test-case "check-not-exn"
(check-not-exn
(lambda () (fail-check "The Message")))))]
[result (test-failure-result (car (run-test case)))]
[names (map check-info-name
(exn:test:check-stack result))])
(check-equal?
"The Message"
(exn-message result))))
;; Verify that check-exn and check-not-exn raise errors (not check
;; failures) if not given thunks.