Handle errors during tests.
This commit is contained in:
parent
6bf0225fba
commit
b1712b76d1
|
@ -105,6 +105,11 @@ transcript.
|
||||||
(set! number-of-tests (add1 number-of-tests))
|
(set! number-of-tests (add1 number-of-tests))
|
||||||
(printf "~s ==> " form)
|
(printf "~s ==> " form)
|
||||||
(flush-output)
|
(flush-output)
|
||||||
|
(with-handlers ([(λ (e) (not (exn:break? e))) ;; handle "exceptions" that are arbitrary values
|
||||||
|
(λ (e)
|
||||||
|
(printf "GOT EXN ~s\n" e)
|
||||||
|
(record-error (list `(EXN ,e) expect form))
|
||||||
|
(printf " BUT EXPECTED ~s\n" expect))])
|
||||||
(let ([res (if (procedure? fun)
|
(let ([res (if (procedure? fun)
|
||||||
(if kws (keyword-apply fun kws kvs args) (apply fun args))
|
(if kws (keyword-apply fun kws kvs args) (apply fun args))
|
||||||
(car args))])
|
(car args))])
|
||||||
|
@ -113,7 +118,7 @@ transcript.
|
||||||
(unless ok?
|
(unless ok?
|
||||||
(record-error (list res expect form))
|
(record-error (list res expect form))
|
||||||
(printf " BUT EXPECTED ~s\n" expect))
|
(printf " BUT EXPECTED ~s\n" expect))
|
||||||
ok?)))
|
ok?))))
|
||||||
(define (test/kw kws kvs expect fun . args) (test* expect fun args kws kvs))
|
(define (test/kw kws kvs expect fun . args) (test* expect fun args kws kvs))
|
||||||
(define (test expect fun . args) (test* expect fun args #f #f))
|
(define (test expect fun . args) (test* expect fun args #f #f))
|
||||||
(make-keyword-procedure test/kw test)))
|
(make-keyword-procedure test/kw test)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user