From 5a3c78a9984635d05b8a49ea03b8cdfe2bb9aaa5 Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Fri, 11 Nov 2011 18:12:54 -0500 Subject: [PATCH] universe now terminates properly --- collects/2htdp/private/universe.rkt | 2 +- collects/2htdp/tests/on-tick-universe-with-limit.rkt | 12 ++++-------- collects/2htdp/tests/struct-universe.rkt | 4 +++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/collects/2htdp/private/universe.rkt b/collects/2htdp/private/universe.rkt index 37cd530f5f..2d6f47cfe4 100644 --- a/collects/2htdp/private/universe.rkt +++ b/collects/2htdp/private/universe.rkt @@ -89,7 +89,7 @@ (define nxt (name (send universe get) a ...)) (define-values (u mails bad) (if (stop-the-world? nxt) - (error 'stop! "the universe stopped: ~e" (stop-the-world-world nxt)) + (stop! (stop-the-world-world nxt)) (bundle> n nxt))) (send universe set (format "value returned from ~a" 'name) u) (unless (boolean? to-string) (send gui add (to-string u))) diff --git a/collects/2htdp/tests/on-tick-universe-with-limit.rkt b/collects/2htdp/tests/on-tick-universe-with-limit.rkt index affce61ded..fea6032790 100644 --- a/collects/2htdp/tests/on-tick-universe-with-limit.rkt +++ b/collects/2htdp/tests/on-tick-universe-with-limit.rkt @@ -2,12 +2,8 @@ (require 2htdp/universe 2htdp/image) -(with-handlers ((exn? (lambda (w) - (unless (string=? "stop!: the universe stopped: 3" (exn-message w)) - (raise w))))) - (universe 0 - (on-tick (lambda (w) (make-bundle (add1 w) '() '())) 1/28 3) - (on-msg void) - (on-new cons)) - (error "the universe didn't stop properly")) +(universe 0 + (on-tick (lambda (w) (make-bundle (add1 w) '() '())) 1/28 3) + (on-msg void) + (on-new cons)) \ No newline at end of file diff --git a/collects/2htdp/tests/struct-universe.rkt b/collects/2htdp/tests/struct-universe.rkt index 5b9a593af3..7f8f2320f4 100644 --- a/collects/2htdp/tests/struct-universe.rkt +++ b/collects/2htdp/tests/struct-universe.rkt @@ -32,7 +32,9 @@ (on-new (lambda (w n) (make-bundle (cons n w) '() '()))) (on-tick (lambda (w*) - (make-bundle w* (map (lambda (w) (make-mail w 'go)) w*) '()))) + (make-bundle w* (map (lambda (w) (make-mail w 'go)) w*) '())) + 1 + 3) (on-msg (lambda (state iw msg) ;; display the received prefabbed struct's content