[racket] Help with exception raising and testing

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

Also, here's a small additional bit of code to demonstrate what test-exn is
actually checking.

(require rackunit)

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

;fail -- "Wrong exception raised"
(test-exn "negative coin" exn:fail:filesystem? (λ _ (sum-coins -1 3 5 7) ))
 
;fail -- "No exception raised"
(test-exn "negative coin" exn:fail:filesystem? (λ _ (sum-coins +1 3 5 7) ))



Posted on the users mailing list.