diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-11-16 02:59:54 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-11-22 00:00:05 +0100 |
commit | 8489d6406460d93d7a55f49dcaa79ee3352a43b0 (patch) | |
tree | 4ddb67ca0fc2427e96c5f66f416fb53d8a9d6cfc /tests/unit/util/exceptions.scm | |
parent | Add tests for io utilities. (diff) | |
download | calp-8489d6406460d93d7a55f49dcaa79ee3352a43b0.tar.gz calp-8489d6406460d93d7a55f49dcaa79ee3352a43b0.tar.xz |
Add some tests for exception utilities.
Diffstat (limited to 'tests/unit/util/exceptions.scm')
-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)) |