[racket] Help with exception raising and testing

From: Galler (lzgaller at optonline.net)
Date: Tue Aug 27 16:29:37 EDT 2013

Two issues:

1: wrap the function-under-test in a thunk

2. check for exception type, here exn:fail:contract? which is raised by
raise-argument-error.  the more general exn:fail? would also work.

(require rackunit)

(test-exn "negative coin" exn:fail:contract? (λ _ (sum-coins -1 3 5 7) ))


Posted on the users mailing list.