From 7da7c5ecb22c2f37fa7fb735b5fdb61d7dbc93da Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 30 May 2010 17:37:11 -0700 Subject: [PATCH] Improve test reporting for errors. Add boolean equality assertions. --- tests/unit-testing.scm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/unit-testing.scm b/tests/unit-testing.scm index 1b1d2ef58..1e95c9a1e 100644 --- a/tests/unit-testing.scm +++ b/tests/unit-testing.scm @@ -248,6 +248,11 @@ USA. (define (report-failure failure port) (cond ((failure-property 'CONDITION failure) => (lambda (p) + (let ((expr (failure-property 'EXPRESSION failure))) + (if expr + (begin + (write-expr-property #f expr port) + (write-string " " port)))) (write-string "failed with error: " port) (write-condition-report (cdr p) port))) ((failure-feature 'RESULT failure) @@ -369,6 +374,10 @@ USA. (define-for-tests assert-> (binary-assertion >)) (define-for-tests assert->= (binary-assertion >=)) +(define-for-tests assert-boolean-= (binary-assertion boolean=?)) +(define-for-tests assert-boolean-!= + (binary-assertion (lambda (x y) (not (boolean=? x y))))) + (define-for-tests (assert-error thunk condition-types . properties) (call-with-current-continuation (lambda (k) -- 2.25.1