Debian Codegraph @

guile/tests/errors.scm

raw
1 ;;; GnuTLS --- Guile bindings for GnuTLS.
2 ;;; Copyright (C) 2007-2025 Free Software Foundation, Inc.
3 ;;;
4 ;;; This file is part of Guile-GnuTLS.
5 ;;;
6 ;;; This program is free software: you can redistribute it and/or modify
7 ;;; it under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation, either version 3 of the License, or
9 ;;; (at your option) any later version.
10 ;;;
11 ;;; This program is distributed in the hope that it will be useful,
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19 ;;; Written by Ludovic Courtès <[email protected]>.
20
21
22 ;;;
23 ;;; Test the error/exception mechanism.
24 ;;;
25
26 (use-modules (gnutls)
27 (gnutls build tests))
28
29 (run-test
30 (lambda ()
31 (and (fatal-error? error/hash-failed)
32 (not (fatal-error? error/reauth-request))
33
34 (let ((s (make-session connection-end/server)))
35 (catch 'gnutls-error
36 (lambda ()
37 (handshake s))
38 (lambda (key err function . currently-unused)
39 (and (eq? key 'gnutls-error)
40 err
41 (fatal-error? err)
42 (string? (error->string err))
43 (eq? function 'handshake))))))))
44
45 ;;; arch-tag: 73ed6229-378d-4a12-a5c6-4c2586c6e3a2