From e62510c4f14a5c1bf246462a0cdf7aecc9031136 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Fri, 14 Mar 2003 09:02:05 +0000 Subject: [PATCH] + Catch and report errors + Use scheme-with-scsh --- scsh/test/test-base.scm | 35 ++++++++++++++++++++++------------- scsh/test/test-packages.scm | 19 +++++++------------ 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/scsh/test/test-base.scm b/scsh/test/test-base.scm index ec26b65..af34bbc 100644 --- a/scsh/test/test-base.scm +++ b/scsh/test/test-base.scm @@ -118,20 +118,29 @@ (if (not silent) (display-start)) - (if (apply proc args) - (begin - (if silent - (display ".") + (call-with-current-continuation + (lambda (k) + (if (with-handler + (lambda (cond more) + (display "Error: ") + (display cond) + (newline) + (k #f)) + (lambda () + (apply proc args))) + (begin + (if silent + (display ".") (display "OK\n")) - #t) - (begin - (if silent - (begin (newline) - (display-start))) - (display "Error! Input was ") - (display args) - (newline) - #f))))) + #t) + (begin + (if silent + (begin (newline) + (display-start))) + (display "Error! Input was ") + (display args) + (newline) + #f))))))) ;; --- Exported functions to make a test ------------------------------- ;; The following 3 functions start the testing. They all have an diff --git a/scsh/test/test-packages.scm b/scsh/test/test-packages.scm index 7ca5d83..8d202c4 100644 --- a/scsh/test/test-packages.scm +++ b/scsh/test/test-packages.scm @@ -8,21 +8,19 @@ test-summary)) (define-structure test-base test-base-interface - (open scsh - scheme + (open scheme-with-scsh + handle list-lib define-record-types) (files test-base)) (define-structure file-system-test (export) - (open scsh - scheme + (open scheme-with-scsh test-base) (files file-system-tests)) (define-structure process-state-test (export) - (open scsh - scheme + (open scheme-with-scsh test-base) (files process-state-tests)) @@ -41,8 +39,7 @@ exec-path-list-test add-before-test add-after-test) - (open scsh - scheme + (open scheme-with-scsh thread-fluids list-lib string-lib) @@ -50,15 +47,13 @@ (define-structure add-env-test (export) - (open scsh - scheme + (open scheme-with-scsh test-base env-test) (files env-test-add)) (define-structure system-parameter-tests (export) - (open scsh - scheme + (open scheme-with-scsh test-base) (begin (add-test! 'uname 'system-parameter