Improve test reporting for errors. Add boolean equality assertions.
authorChris Hanson <org/chris-hanson/cph>
Mon, 31 May 2010 00:37:11 +0000 (17:37 -0700)
committerChris Hanson <org/chris-hanson/cph>
Mon, 31 May 2010 00:37:11 +0000 (17:37 -0700)
tests/unit-testing.scm

index 1b1d2ef58866b2826816a807799886519b97d3fc..1e95c9a1ee924880d3ad0a7273dd4d1466ae2efa 100644 (file)
@@ -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)