tests/unit-testing.scm: Add expectation to assert-error failure.
authorMatt Birkholz <matt@birchwood-abbey.net>
Wed, 1 Feb 2017 07:30:11 +0000 (00:30 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Wed, 1 Feb 2017 07:52:26 +0000 (00:52 -0700)
Recently bytevector-u8-ref did not signal a range error but returned a
random value.  The failure report only said "value <random>".  Now it
also includes the expected condition type(s).

tests/unit-testing.scm

index 0b965e86a8be3b1c9022f3c21aa273d019473d07..c894abcc651db15ef141c6cd438137ce057da721 100644 (file)
@@ -397,19 +397,21 @@ USA.
   (predicate-assertion null? "an empty list"))
 \f
 (define-for-tests (assert-error thunk #!optional condition-types . properties)
-  (call-with-current-continuation
-   (lambda (k)
-     (apply fail
-           'RESULT-OBJECT
-           (bind-condition-handler
-               (if (default-object? condition-types)
-                   (list condition-type:error)
-                   condition-types)
-               (lambda (condition)
-                 condition             ;ignore
-                 (k #f))
-             thunk)
-           properties))))
+  (let ((condition-types (if (default-object? condition-types)
+                            (list condition-type:error)
+                            condition-types)))
+    (call-with-current-continuation
+     (lambda (k)
+       (apply fail
+             'RESULT-OBJECT
+             (bind-condition-handler
+                 condition-types
+                 (lambda (condition)
+                   condition           ;ignore
+                   (k #f))
+               thunk)
+             'EXPECTATION-OBJECT condition-types
+             properties)))))
 
 (define-for-tests (error-assertion . condition-types)
   (lambda (thunk . properties)