From b98b83b672a9b4cbcca472b74aa899b1cf16951a Mon Sep 17 00:00:00 2001 From: Mike Sperber Date: Fri, 8 Oct 2010 10:25:37 +0200 Subject: [PATCH] Make uncaught exceptions in teaching languages pop up test-engine display. ... so as to catch any test-case failures or signature violations that may have occurred. --- collects/deinprogramm/deinprogramm-langs.rkt | 7 ++++++- collects/lang/htdp-langs.rkt | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/collects/deinprogramm/deinprogramm-langs.rkt b/collects/deinprogramm/deinprogramm-langs.rkt index 8759c82758..3657260907 100644 --- a/collects/deinprogramm/deinprogramm-langs.rkt +++ b/collects/deinprogramm/deinprogramm-langs.rkt @@ -191,7 +191,12 @@ ;; hack: the test-engine code knows about the test~object name; we do, too (namespace-set-variable-value! 'test~object (build-test-engine)) - ;; record test-case failures with the test engine + (uncaught-exception-handler + (let ((previous (uncaught-exception-handler))) + (lambda (exc) + (display-results) + (previous exc)))) + ;; record signature violations with the test engine (signature-violation-proc (lambda (obj signature message blame) (cond diff --git a/collects/lang/htdp-langs.rkt b/collects/lang/htdp-langs.rkt index a5ba78d5ae..4780adb251 100644 --- a/collects/lang/htdp-langs.rkt +++ b/collects/lang/htdp-langs.rkt @@ -33,7 +33,8 @@ (only-in test-engine/scheme-gui make-formatter) (only-in test-engine/scheme-tests - scheme-test-data error-handler test-format test-execute build-test-engine) + scheme-test-data error-handler test-format test-execute display-results + build-test-engine) (lib "test-engine/test-display.scm") deinprogramm/signature/signature ) @@ -155,7 +156,12 @@ (namespace-require scheme-signature-module-name) ;; hack: the test-engine code knows about the test~object name; we do, too (namespace-set-variable-value! 'test~object (build-test-engine)) - ;; record test-case failures with the test engine + (uncaught-exception-handler + (let ((previous (uncaught-exception-handler))) + (lambda (exc) + (display-results) + (previous exc)))) + ;; record signature violations with the test engine (signature-violation-proc (lambda (obj signature message blame) (cond