racket/collects/2htdp/tests-failed/key-error.rkt
2011-08-13 12:02:59 -04:00

21 lines
806 B
Racket

#lang racket
;; ---------------------------------------------------------------------------------------------------
;; the error message should refer to the 'on-tick handler, not the lambda in the clause
(require 2htdp/universe)
(require 2htdp/image)
(define (main)
(big-bang 0
(on-tick (lambda (w) "3"))
(to-draw (lambda (w) (circle 10 'solid 'red)))
(check-with number?)))
(with-handlers ((exn:fail? (lambda (x)
(define msg (exn-message x))
(define hdl (regexp-match "check-with: (.*) returned" msg))
(unless (and hdl (cons? (regexp-match "on-tick" (second hdl))))
(error 'test "expected: \"on-tick\", actual: ~e" (second hdl))))))
(main))