From 8489d6406460d93d7a55f49dcaa79ee3352a43b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 16 Nov 2023 02:59:54 +0100 Subject: Add some tests for exception utilities. --- tests/unit/util/exceptions.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/unit/util/exceptions.scm 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)) -- cgit v1.2.3