plt/racket — pull request #484 by davidtpierson (2013-11-07 04:38:16+00:00)
Title: rackunit: make check-exn/check-not-exn raise error if given a non-thunk

Previously, (check-exn exn? 'foo) would pass even though 'foo is not a
thunk. Now it raises an exn:fail:contract? exception.

Previously, (check-not-exn 'foo) would produce a check failure. Now it
raises an exn:fail:contract? exception.

*** ADDITIONAL NOTE for pull request comment ***

This patch adds code within check-exn (and check-not-exn) to verify that
the given thunk is a procedure accepting 0 arguments.

My motivation was to remedy the problem of failing to specify a valid
thunk for the thunk argument of check-exn and yet not seeing any error
or test failure (because the application of the non-thunk raised an
exception matching the predicate.) The change to check-not-exn was to
be consistent in comparison with check-exn, and also it seemed to me to
be more "correct" to raise an error rather than a check failure.

I looked at changing the documentation but I believe my changes are
consistent with the current docs -- I couldn't find anything that needed
changing.