aboutsummaryrefslogtreecommitdiffstats
path: root/testing.csc
diff options
context:
space:
mode:
Diffstat (limited to 'testing.csc')
-rw-r--r--testing.csc12
1 files changed, 11 insertions, 1 deletions
diff --git a/testing.csc b/testing.csc
index aebc574..a0180e6 100644
--- a/testing.csc
+++ b/testing.csc
@@ -2,6 +2,7 @@
(export
assert
assert-equal
+ assert-raises
test
test-main)
(import (scheme base)
@@ -53,7 +54,7 @@
(syntax-rules ()
((assert expr)
(unless expr
- (fatalf "Assertion {} failed." 'expr)))))
+ (fatalf "(assert {}) failed." 'expr)))))
(define-syntax assert-equal
@@ -65,6 +66,15 @@
(fatalf "Fatal: {} is not equal to {}.\nleft is {}\nright is {}" 'left 'right x y))))))
+ (define-syntax assert-raises
+ (syntax-rules ()
+ ((assert-raises predicate body body* ...)
+ (assert
+ (guard (e ((predicate e) #t))
+ body body* ...
+ #f)))))
+
+
(define (test-main)
(if *all-tests-succeeded*
(printf "PASS\n")