diff options
-rw-r--r-- | tests/unit/util/exceptions.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/util/exceptions.scm b/tests/unit/util/exceptions.scm new file mode 100644 index 00000000..99e484cf --- /dev/null +++ b/tests/unit/util/exceptions.scm @@ -0,0 +1,24 @@ +(define-module (test exceptions) + :use-module (srfi srfi-64) + :use-module (srfi srfi-64 test-error) + :use-module (srfi srfi-88) + :use-module (hnh util exceptions)) + +(test-group "Warnings" + (parameterize ((warning-handler (lambda (fmt . args) + (test-equal "Test: ~a" fmt) + (test-equal '(1) args))) + (warnings-are-errors #f)) + (warning "Test: ~a" 1)) + + (parameterize ((warning-handler (lambda (fmt . args) + (test-equal "~a happened" fmt) + (test-equal '(2) args))) + (warnings-are-errors #t)) + (test-error 'warning + (warning "~a happened" 2)))) + +(test-error "Unreachable" + 'unreachable (unreachable "procedure" "fmt" (list))) + +'((hnh util exceptions)) |