Add support for testing error conditions and warnings in EvaluationTests,
and fix a few bugs that the new tests exposed.