diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-01-09 22:55:59 -0800 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-01-09 22:55:59 -0800 |
| commit | 77583a881b03ce38c8065c40641489fe88b61eb2 (patch) | |
| tree | d4f65cfd698fee8e63168b4a5b64ab4123177fc3 /testing.csc | |
| parent | Remove str- prefixes from the strings library. (diff) | |
| download | chromatopelma-77583a881b03ce38c8065c40641489fe88b61eb2.tar.zst | |
Write the linker.
Diffstat (limited to 'testing.csc')
| -rw-r--r-- | testing.csc | 12 |
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") |
