diff options
author | Kevin Ryde <user42@zip.com.au> | 2004-01-03 21:12:01 +0000 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2004-01-03 21:12:01 +0000 |
commit | 9bc915bb075c1a72a45cbd8a5dc52a36d945834a (patch) | |
tree | 0ae31f58cde977093a75e48ff419fc1402da77c1 | |
parent | b83fc1070c8d8c97c3f47510b1887a53217e1897 (diff) | |
download | guile-9bc915bb075c1a72a45cbd8a5dc52a36d945834a.tar.gz |
(false-if-exception): Add tests.
-rw-r--r-- | test-suite/tests/exceptions.test | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test-suite/tests/exceptions.test b/test-suite/tests/exceptions.test index cb3fcfa38..05f464563 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 Free Software Foundation, Inc. +;;;; Copyright (C) 2001, 2003, 2004 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 @@ -16,6 +16,8 @@ ;;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +(use-modules (test-suite lib)) + (with-test-prefix "throw/catch" (with-test-prefix "wrong type argument" @@ -59,3 +61,24 @@ (catch 'a (lambda () (throw 'a)) (lambda (x y . rest) #f))))) + +(with-test-prefix "false-if-exception" + + (pass-if (false-if-exception #t)) + (pass-if (not (false-if-exception #f))) + (pass-if (not (false-if-exception (error "xxx")))) + + (with-test-prefix "in empty environment" + ;; an environment with no bindings at all + (define empty-environment + (make-module 1)) + + (pass-if "#t" + (eval `(,false-if-exception #t) + empty-environment)) + (pass-if "#f" + (not (eval `(,false-if-exception #f) + empty-environment))) + (pass-if "exception" + (not (eval `(,false-if-exception (,error "xxx")) + empty-environment))))) |