Small changes/fixes to rackunit.
* Add optional message for fail-check. * Correctly shorten column name.
This commit is contained in:
parent
f754624e9a
commit
02b9de16bd
|
@ -419,10 +419,12 @@ if the macro @racket[fail-check] is called in the body of
|
|||
the check. This allows more flexible checks, and in
|
||||
particular more flexible reporting options.}
|
||||
|
||||
@defform[(fail-check)]{
|
||||
@defform*[[(fail-check)
|
||||
(fail-check message-expr)]]{
|
||||
|
||||
The @racket[fail-check] macro raises an @racket[exn:test:check] with
|
||||
the contents of the check information stack.
|
||||
the contents of the check information stack. The optional message
|
||||
is used as the exception's message.
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -70,14 +70,19 @@
|
|||
|
||||
(define-syntax fail-check
|
||||
(syntax-rules ()
|
||||
((_)
|
||||
(let ([marks (current-continuation-marks)])
|
||||
((_ message*)
|
||||
(let ([message message*]
|
||||
[marks (current-continuation-marks)])
|
||||
(unless (string? message)
|
||||
(raise-type-error 'fail-check "string" message))
|
||||
(test-log! #f)
|
||||
(raise
|
||||
(make-exn:test:check
|
||||
"Check failure"
|
||||
message
|
||||
marks
|
||||
(check-info-stack marks)))))))
|
||||
(check-info-stack marks)))))
|
||||
((_)
|
||||
(fail-check "Check failure"))))
|
||||
|
||||
(define-syntax fail-internal
|
||||
(syntax-rules ()
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
[(m . < . n)
|
||||
(string-append s (make-string (- n m) #\space))]
|
||||
[else
|
||||
(substring s n)]))
|
||||
(substring s 0 n)]))
|
||||
|
||||
(define (display-check-info-name-value name value [value-printer write])
|
||||
(display (string-pad-right
|
||||
|
|
Loading…
Reference in New Issue
Block a user