diff options
author | Andy Wingo <wingo@pobox.com> | 2010-01-31 12:35:19 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-02-26 11:56:02 +0100 |
commit | e10cf6b9c7e54c79db4de74584f1b0b65847d4fc (patch) | |
tree | 3df9ed5f6b52af3b0ffd5605e2f8834705bb589c /test-suite/tests/exceptions.test | |
parent | d296431516dbf14535fc6eaba551fede19c09772 (diff) | |
download | guile-e10cf6b9c7e54c79db4de74584f1b0b65847d4fc.tar.gz |
deprecate lazy-catch
* libguile/deprecated.h:
* libguile/deprecated.c (scm_internal_lazy_catch, scm_lazy_catch):
Deprecate, and print out a nasty warning that people should change to
with-throw-handler.
* libguile/throw.h:
* libguile/throw.c (scm_c_with_throw_handler): Deprecate the use of the
lazy_catch_p argument, printing out a nasty warning if someone
actually passes 1 as that argument. The combination of the pre-unwind
and post-unwind handlers should be sufficient.
* test-suite/tests/exceptions.test: Remove lazy-catch tests, as they are
deprecated. Two of them fail:
* throw/catch: effect of lazy-catch unwinding on throw to another key
* throw/catch: repeat of previous test but with lazy-catch
Hopefully people are not depending on this behavior, and the warning is
sufficiently nasty for people to switch. We will see.
* test-suite/tests/eval.test ("promises"): Use with-throw-handler
instead of lazy-catch.
* doc/ref/api-debug.texi:
* doc/ref/api-control.texi: Update to remove references to lazy-catch,
folding in the useful bits to with-throw-handler.
Diffstat (limited to 'test-suite/tests/exceptions.test')
-rw-r--r-- | test-suite/tests/exceptions.test | 153 |
1 files changed, 20 insertions, 133 deletions
diff --git a/test-suite/tests/exceptions.test b/test-suite/tests/exceptions.test index c2ec5f48d..bcaa282e5 100644 --- a/test-suite/tests/exceptions.test +++ b/test-suite/tests/exceptions.test @@ -1,5 +1,5 @@ ;;;; exceptions.test --- tests for Guile's exception handling -*- scheme -*- -;;;; Copyright (C) 2001, 2003, 2004, 2006 Free Software Foundation, Inc. +;;;; Copyright (C) 2001, 2003, 2004, 2006, 2010 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -75,9 +75,9 @@ (lambda () (throw 'a)) (lambda (x y . rest) #f)))) - (with-test-prefix "with lazy handler" + (with-test-prefix "with pre-unwind handler" - (pass-if "lazy fluid state" + (pass-if "pre-unwind fluid state" (equal? '(inner outer arg) (let ((fluid-parm (make-fluid)) (inner-val #f)) @@ -102,32 +102,34 @@ (lambda (key . args) (push 2)))) - (throw-test "catch and lazy catch" + (throw-test "catch and with-throw-handler" '(1 2 3 4) (catch 'a (lambda () (push 1) - (lazy-catch 'a - (lambda () - (push 2) - (throw 'a)) - (lambda (key . args) - (push 3)))) + (with-throw-handler + 'a + (lambda () + (push 2) + (throw 'a)) + (lambda (key . args) + (push 3)))) (lambda (key . args) (push 4)))) - (throw-test "catch with rethrowing lazy catch handler" + (throw-test "catch with rethrowing throw-handler" '(1 2 3 4) (catch 'a (lambda () (push 1) - (lazy-catch 'a - (lambda () - (push 2) - (throw 'a)) - (lambda (key . args) - (push 3) - (apply throw key args)))) + (with-throw-handler + 'a + (lambda () + (push 2) + (throw 'a)) + (lambda (key . args) + (push 3) + (apply throw key args)))) (lambda (key . args) (push 4)))) @@ -183,27 +185,6 @@ (lambda (key . args) (push 4)))) - (throw-test "effect of lazy-catch unwinding on throw to another key" - '(1 2 3 5 7) - (catch 'a - (lambda () - (push 1) - (lazy-catch 'b - (lambda () - (push 2) - (catch 'a - (lambda () - (push 3) - (throw 'b)) - (lambda (key . args) - (push 4)))) - (lambda (key . args) - (push 5) - (throw 'a))) - (push 6)) - (lambda (key . args) - (push 7)))) - (throw-test "effect of with-throw-handler not-unwinding on throw to another key" '(1 2 3 5 4 6) (catch 'a @@ -225,27 +206,6 @@ (lambda (key . args) (push 7)))) - (throw-test "lazy-catch chaining" - '(1 2 3 4 6 8) - (catch 'a - (lambda () - (push 1) - (lazy-catch 'a - (lambda () - (push 2) - (lazy-catch 'a - (lambda () - (push 3) - (throw 'a)) - (lambda (key . args) - (push 4))) - (push 5)) - (lambda (key . args) - (push 6))) - (push 7)) - (lambda (key . args) - (push 8)))) - (throw-test "with-throw-handler chaining" '(1 2 3 4 6 8) (catch 'a @@ -267,48 +227,6 @@ (lambda (key . args) (push 8)))) - (throw-test "with-throw-handler inside lazy-catch" - '(1 2 3 4 6 8) - (catch 'a - (lambda () - (push 1) - (lazy-catch 'a - (lambda () - (push 2) - (with-throw-handler 'a - (lambda () - (push 3) - (throw 'a)) - (lambda (key . args) - (push 4))) - (push 5)) - (lambda (key . args) - (push 6))) - (push 7)) - (lambda (key . args) - (push 8)))) - - (throw-test "lazy-catch inside with-throw-handler" - '(1 2 3 4 6 8) - (catch 'a - (lambda () - (push 1) - (with-throw-handler 'a - (lambda () - (push 2) - (lazy-catch 'a - (lambda () - (push 3) - (throw 'a)) - (lambda (key . args) - (push 4))) - (push 5)) - (lambda (key . args) - (push 6))) - (push 7)) - (lambda (key . args) - (push 8)))) - (throw-test "throw handlers throwing to each other recursively" '(1 2 3 4 8 6 10 12) (catch #t @@ -340,37 +258,6 @@ (lambda (key . args) (push 12)))) - (throw-test "repeat of previous test but with lazy-catch" - '(1 2 3 4 8 12) - (catch #t - (lambda () - (push 1) - (lazy-catch 'a - (lambda () - (push 2) - (lazy-catch 'b - (lambda () - (push 3) - (lazy-catch 'c - (lambda () - (push 4) - (throw 'b) - (push 5)) - (lambda (key . args) - (push 6) - (throw 'a))) - (push 7)) - (lambda (key . args) - (push 8) - (throw 'c))) - (push 9)) - (lambda (key . args) - (push 10) - (throw 'b))) - (push 11)) - (lambda (key . args) - (push 12)))) - (throw-test "throw handler throwing to lexically inside catch" '(1 2 7 5 4 6 9) (with-throw-handler 'a |