Skip to content

Commit cbd55b1

Browse files
AlexKnauthsamth
authored andcommitted
Fix failures discovered in PR #138 discussion
When an `exn` is raised, use the check-info stack at the point the exception was raised, not the one at the point `(current-check-around)` was called. (cherry picked from commit c9ff45e)
1 parent 4093675 commit cbd55b1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

rackunit-lib/rackunit/private/format.rkt

+20
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
(module+ for-test
1313
(provide display-check-info-stack))
1414

15+
;; continuation-mark-set-parameter-value : Continuation-Mark-Set (Parameterof X) -> X
16+
(module continuation-mark-set-parameter-value racket/base
17+
(require (only-in '#%paramz parameterization-key))
18+
(provide continuation-mark-set-parameter-value)
19+
(define (continuation-mark-set-parameter-value marks param)
20+
(call-with-parameterization
21+
(continuation-mark-set-first marks parameterization-key)
22+
param)))
23+
(require 'continuation-mark-set-parameter-value)
24+
1525
;; name-width : integer
1626
;;
1727
;; Number of characters we reserve for the check-info name column
@@ -123,6 +133,11 @@
123133
(display-check-info-stack (exn:test:check-stack e)
124134
#:verbose? verbose?)
125135
(display-raised-message e)]
136+
[(exn? e)
137+
(display-raised-summary "ERROR" e)
138+
(display-check-info-stack (exn-check-info e)
139+
#:verbose? verbose?)
140+
(display-raised-message e)]
126141
[else
127142
(display-raised-summary "ERROR" e)
128143
(display-check-info-stack (current-check-info)
@@ -144,3 +159,8 @@
144159
(parameterize ([error-print-context-length 0])
145160
((error-display-handler) desc raised-value))
146161
(displayln desc)))
162+
163+
;; exn-check-info : Exn -> (Listof Check-Info)
164+
(define (exn-check-info e)
165+
(continuation-mark-set-parameter-value (exn-continuation-marks e)
166+
current-check-info))

0 commit comments

Comments
 (0)