error in tp uses contract exn now, misc

svn: r14839
This commit is contained in:
Matthias Felleisen 2009-05-15 22:01:11 +00:00
parent 8e79a2aed5
commit 399d07907a
4 changed files with 16 additions and 12 deletions

View File

@ -2,7 +2,7 @@
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname matrix-test) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
;(require htdp/matrix-invisible)
(require htdp/matrix)
(require (lib "matrix.ss" "htdp"))
(define r1 '((a00 a01 a02)
(a10 a11 a12)))
@ -52,5 +52,5 @@
;; --- IMPERATIVE ---
(check-expect (matrix-ref m1 0 0) 'a00)
(define m1-modified (matrix-set! m1 0 0 'xxx)) ;; <-------- uncomment this and the test engine breaks
(check-expect (matrix-ref m1 0 0) 'xxx)
;(define m1-modified (matrix-set! m1 0 0 'xxx)) ;; <-------- uncomment this and the test engine breaks
;(check-expect (matrix-ref m1 0 0) 'xxx)

View File

@ -1,6 +1,7 @@
;; The first three lines of this file were inserted by DrScheme. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname world-add-line) (read-case-sensitive #t) (teachpacks ((lib "world.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "world.ss" "teachpack" "htdp")))))
(require (lib "world.ss" "htdp"))
;(require htdp/world)
(define plain (empty-scene 100 100))

View File

@ -1,6 +1,6 @@
;; The first three lines of this file were inserted by DrScheme. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname world) (read-case-sensitive #t) (teachpacks ((lib "world.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "world.ss" "teachpack" "htdp")))))
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname world) (read-case-sensitive #t) (teachpacks ((lib "universe.ss" "teachpack" "2htdp") (lib "foo.ss" "installed-teachpacks"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "universe.ss" "teachpack" "2htdp") (lib "foo.ss" "installed-teachpacks")))))
;; testing world
;; World = Nat
@ -27,14 +27,15 @@
(check-expect (key=? 'a #\a) false)
(check-expect (key=? 'left 'left) true)
(check-error (key=? 'a 0) "key=?: expected <KeyEvent> as first argument, given: 0")
(check-error (key=? 'a 0) "key=?: expected <KeyEvent> as second argument, given: 0")
;; run world run
(big-bang 100 100 .01 world0 true) ;; get ready to create images
xxx
(on-redraw world->image)
(on-tick-event world->next)
(on-key-event world->steer)
(stop-when zero?)
(big-bang world0
(on-draw world->image)
(on-tick world->next)
(on-key world->steer)
(stop-when zero?))

View File

@ -34,8 +34,10 @@
(define-struct (tp-exn exn) ())
(define (tp-error name fmt . args)
(raise (make-tp-exn (string-append (format "~a: " name) (apply format fmt args))
(current-continuation-marks))))
(raise
(make-exn:fail:contract #; make-tp-exn
(string-append (format "~a: " name) (apply format fmt args))
(current-continuation-marks))))
(define (number->ord i)
(if (= i 0)