Allow typecheck tests to specify a failure regexp.

The regexp checks against the exception error message.
I'm adding this because it will be useful for unit
tests for type-checking classes.