On 2013-08-27 14:33:54 -0400, George Rudolph wrote: > #lang racket > > (require rackunit "mybasic.rkt") > > (test-exn "negative coin" negative? (sum-coins -1 3 5 7) )
There is a common mistake here that myself and other Racket programmers frequently make. The various rackunit functions that deal with exceptions take a *thunk* that contains the code to run. So `(sum-coins -1 3 5 7)` should be `(λ () (sum-coins -1 3 5 7))` or `(thunk (sum-coins -1 3 5 7))`. In addition, the test predicate should take an exception value so `negative?` won't work. You probably want a predicate like `(λ (e) (regexp-match #rx"negative?" (exn-message e)))` instead. Cheers, Asumu ____________________ Racket Users list: http://lists.racket-lang.org/users