;;;; srfi-34.test --- test suite for SRFI-34 -*- scheme -*-
;;;;
-;;;; Copyright (C) 2003 Free Software Foundation, Inc.
+;;;; Copyright (C) 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this software; see the file COPYING. If not, write to
-;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-;;;; Boston, MA 02111-1307 USA
+;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;;;; Boston, MA 02110-1301 USA
(define-module (test-suite test-srfi-34)
+ :duplicates (last) ;; avoid warning about srfi-34 replacing `raise'
:use-module (test-suite lib)
:use-module (srfi srfi-13)
:use-module (srfi srfi-34))
""
'(b . 23)))
-)
+ (pass-if "`with-exception-handler' invokes HANDLER in THUNK's dynamic env."
+ ;; In Guile 1.8.5 and earlier, unwinders would be called before
+ ;; the exception handler, which reads "The handler is called in
+ ;; the dynamic environment of the call to `raise'".
+ (call/cc
+ (lambda (return)
+ (let ((inside? #f))
+ (with-exception-handler
+ (lambda (c)
+ ;; This handler must be called before the unwinder below.
+ (return inside?))
+ (lambda ()
+ (dynamic-wind
+ (lambda ()
+ (set! inside? #t))
+ (lambda ()
+ (raise 'some-exception))
+ (lambda ()
+ ;; This unwinder should not be executed before the
+ ;; handler is called.
+ (set! inside? #f))))))))))