aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/util/exceptions.scm
blob: 99e484cf26dbd70c61db697281734ad51afe5ab0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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))