[Cppunit-devel] Exception & TestCaller bug
Brought to you by:
blep
From: Baptiste L. <bl...@cl...> - 2001-09-24 21:35:48
|
Yesterday I found a bug in test caller. When an expected exception wasn't caught, it did: throw new Exception(...) instead of throw Exception(...). I went down to the test suite to see why it was not detected. Result: forgot to put a test case for that one. I'm in the process of correcting this, but there is no way I can safely distinguish if "new Exception()" or "Exception()" was thrown. There can only be distinguished by the message. This can be easily corrected. Exception can be subclassed (as is done by NotEqualException). What I propose is to define a set of class to distinguish the exception cause. Here is my proposal: - Exception : base class for all exception. Contains a message - FailureException : thrown when an CPPUNIT_ASSERTxxx fails, or when an expected exception is not caught (this is a form of assertion) - NotEqualException: a specialization of FailureException for CPPUNIT_ASSERT_EQUALxxx. Contains expected and actual string. - UnknownErrorException: thrown when something is caught in a "catch (...)" - SetUpException : thrown when a exception is thrown by setUp(). Contains caught exception. - TearDownException : thrown when an exception is thrown by tearDown(). Contains caught exception. What do you think ? Baptiste. --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/index.html Author of The Text Reformatter, a tool for fanfiction readers and writers. Language: English, French (Well, I'm French). |