[uim-commit] r2073 - branches/r5rs/sigscheme/test

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Nov 7 08:15:04 PST 2005


Author: yamaken
Date: 2005-11-07 08:14:59 -0800 (Mon, 07 Nov 2005)
New Revision: 2073

Modified:
   branches/r5rs/sigscheme/test/test-srfi34-2.scm
   branches/r5rs/sigscheme/test/test-srfi34.scm
Log:
* sigscheme/test/test-srfi34.scm
  - Add new test for with-exception-handler
  - Add SigScheme-dependent tests for the case a handler of
    with-exception-handler returned
* sigscheme/test/test-srfi34-2.scm
  - Add SigScheme-dependent tests for the case a handler of
    with-exception-handler returned


Modified: branches/r5rs/sigscheme/test/test-srfi34-2.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-srfi34-2.scm	2005-11-07 16:09:22 UTC (rev 2072)
+++ branches/r5rs/sigscheme/test/test-srfi34-2.scm	2005-11-07 16:14:59 UTC (rev 2073)
@@ -62,16 +62,20 @@
 (display "test #2")
 (newline)
 ;;PRINTS: something went wrong
-;;then behaves in an unspecified way
+;; Then behaves in an unspecified way. Although the behavior when a handler
+;; returned is not specified in SRFI-34, SigScheme should produce an error to
+;; prevent being misused by users.
 (print-expected "something went wrong")
-(call-with-current-continuation
- (lambda (k)
-   (with-exception-handler (lambda (x)
-                             (display "something went wrong")
-                             (newline)
-                             'dont-care)
-     (lambda ()
-       (+ 1 (raise 'an-error))))))
+(assert-error "Examples of SRFI-34 document"
+              (lambda ()
+                (call-with-current-continuation
+                 (lambda (k)
+                   (with-exception-handler (lambda (x)
+                                             (display "something went wrong")
+                                             (newline)
+                                             'dont-care)
+                     (lambda ()
+                       (+ 1 (raise 'an-error))))))))
 
 (display "test #3")
 (newline)

Modified: branches/r5rs/sigscheme/test/test-srfi34.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-srfi34.scm	2005-11-07 16:09:22 UTC (rev 2072)
+++ branches/r5rs/sigscheme/test/test-srfi34.scm	2005-11-07 16:14:59 UTC (rev 2073)
@@ -35,17 +35,35 @@
 (use srfi-34)
 
 ;; with-exception-handler
+
+;; Although the behavior when a handler returned is not specified in SRFI-34,
+;; SigScheme should produce an error to prevent being misused by users.
 (display "with-exception-handler #1")
 (newline)
-(with-exception-handler
-    (lambda (x)
-      (assert-equal? "with-exception-handler #1" 'an-error x))
-  (lambda ()
-    (+ 1 (raise 'an-error))))
+(assert-error "with-exception-handler #1"
+              (lambda ()
+                (with-exception-handler
+                    (lambda (x)
+                      'a-handler-must-not-return)
+                  (lambda ()
+                    (+ 1 (raise 'an-error))))))
 
 (display "with-exception-handler #2")
 (newline)
-(assert-equal? "with-exception-handler #2"
+(assert-error "with-exception-handler #3"
+              (lambda ()
+                (with-exception-handler
+                    (lambda (x)
+                      (assert-equal? "with-exception-handler #2" 'an-error x)
+                      (display "with-exception-handler #3")
+                      (newline)
+                      'a-handler-must-not-return)
+                  (lambda ()
+                    (+ 1 (raise 'an-error))))))
+
+(display "with-exception-handler #4")
+(newline)
+(assert-equal? "with-exception-handler #4"
                6
 	       (with-exception-handler
                    (lambda (x)
@@ -53,9 +71,9 @@
                  (lambda ()
                    (+ 1 2 3))))
 
-(display "with-exception-handler #3")
+(display "with-exception-handler #5")
 (newline)
-(assert-equal? "with-exception-handler #3"
+(assert-equal? "with-exception-handler #5"
                'success
 	       (with-exception-handler
                    (lambda (x)



More information about the uim-commit mailing list