merged two error checking files

This commit is contained in:
Matthias Felleisen 2010-10-13 15:07:33 -04:00
parent ae04ddc7d9
commit 49060ff57c
2 changed files with 14 additions and 14 deletions

View File

@ -1,13 +0,0 @@
#lang scheme
(require 2htdp/universe)
(define s "")
(define x 0)
(with-handlers ((exn? (lambda _ "success!")))
(big-bang 0
(on-tick (lambda (w) (begin (set! x (+ x 1)) w)))
(to-draw (lambda (w) (set! s (number->string w))))
(on-draw (lambda (w) (set! s (number->string w))))))

View File

@ -1,4 +1,4 @@
#lang scheme/load
#lang racket/load
;; purpose: make sure that each clause exists at most once
;; (why am I running this in scheme/load for the namespace in eval)
@ -38,3 +38,16 @@
(on-tick add1)
(on-tick sub1))))))
(with-handlers ((exn:fail:syntax?
(lambda (e)
(define msg (exn-message e))
(unless (string=? msg "big-bang: duplicate to-draw clause")
(raise e)))))
(eval '(module a racket
(require 2htdp/universe)
(define s "")
(define x 0)
(big-bang 0
(on-tick (lambda (w) (begin (set! x (+ x 1)) w)))
(to-draw (lambda (w) (set! s (number->string w))))
(on-draw (lambda (w) (set! s (number->string w))))) )))