fix bug in 82bb5ba4c8; also add test case

This commit is contained in:
Robby Findler 2013-10-21 16:13:29 -05:00
parent ec77a48d23
commit 6e022706b4
2 changed files with 24 additions and 2 deletions

View File

@ -36,7 +36,7 @@
(syntax-rules ()
[(_ arity)
(lambda (tag)
(lambda (p)
(lambda (p [tag tag])
(syntax-case p ()
[(_ x) #`(proc> #,tag (f2h x) arity)]
[_ (err tag p)])))]
@ -95,7 +95,12 @@
(define n (string->symbol (format "~a handler" (syntax-e (caar spec)))))
(syntax-property i 'inferred-name n))]
[else (loop (cdr spec))])))
(if r ((third s) r `',(car r)) (fourth s)))
(if r
(let ([f (third s)])
(if (procedure-arity-includes? f 2)
(f r `',(car r))
(f r)))
(fourth s)))
Spec))
;; check whether rec? occurs, produces list of keyword x clause pairs

View File

@ -14,3 +14,20 @@
(with-handlers ([exn? (lambda (e) (unless (string=? (exn-message e) txt) (raise e)))])
(big-bang 0 (on-tick add1) (to-draw f))
(error 'error-in-draw "test failed"))
(let ([exn (with-handlers ([exn:fail? values])
(big-bang #f
[to-draw (λ (a b) #f)])
"no error raised")])
(unless (regexp-match #rx"^to-draw:" (exn-message exn))
(eprintf "expected a error message beginning with to-draw:\n")
(raise exn)))
(let ([exn (with-handlers ([exn:fail? values])
(big-bang #f
[on-draw (λ (a b) #f)])
"no error raised")])
(unless (regexp-match #rx"^on-draw:" (exn-message exn))
(eprintf "expected a error message beginning with on-draw:\n")
(raise exn)))