Re: [Cppunit-devel] Subclassing Exception class for better test failure report
Brought to you by:
blep
From: Michael A. <ch...@mu...> - 2001-06-10 18:25:49
|
Just a small point - I would like to be able to use CppUnit in Unicode = projects, so I think it needs some generic string class which chances = dependent on using Unicode or not. It could be a simple typedef to = std::string or std::wstring. Michael Arnoldus ----- Original Message -----=20 From: "Baptiste Lepilleur" <bl...@cl...> To: "Cpp Unit Develpment Mailing List" = <cpp...@li...> Sent: Saturday, June 10, 2000 2:15 PM Subject: [Cppunit-devel] Subclassing Exception class for better test = failure report > I want to allow library users and cppunit to subclass the = Exception > class. >=20 > First purpose for this would be to have a NotEqualException which = would > take two strings in the constructor (acual and expected), allowing = better > error report (put the text on different line, on different edit filed = in a > GUI...). >=20 > Further purpose is to allow users of the library to "create" their = one > assertions and capture more information, while still being able to use > cppunit framework. >=20 > To do this we need: > - be able to duplicate any instance of Exception (or subclassed > Exception) > - identify the actual Exception type so we can downcast if allow. >=20 > To do this, I propose to: > - add "public virtual Exception *clone() const" method which = returns a > copy of the Exception. > - add "protected virtual std::string exceptionType() const" method = which > returns a string that identify the exception type (the most extensible = and > portable way I can think of). > - add "public static bool isInstanceOf( Exception &e )" method to = each > class which inherits Exception. This method returns true if = exceptionType() > return the correct identifier string. >=20 > I'd like to be able to report assertEqual() in a better way soon, = so > feedback is welcome. A simple string work well for simple data, but = when you > are comparing data structure, it's unreadable. >=20 > Thanks, > 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). >=20 >=20 > _______________________________________________ > Cppunit-devel mailing list > Cpp...@li... > http://lists.sourceforge.net/lists/listinfo/cppunit-devel >=20 >=20 >=20 |