[Cppunit-devel] toString() v.s. getName()
Brought to you by:
blep
From: Steve M. R. <ste...@vi...> - 2001-07-07 20:05:06
|
Hi, On Wed, Jun 20, 2001 at 08:42:04AM +0200, Baptiste Lepilleur wrote: [ ... while describing the core classes' functionality ... ] > std::string toString () const: > - My best guess would be describes the test. In Java, and Michael > Feather's original version there is no getName() method, and the toString() > has the role of the getName() method. > > std::string getName () const: > - Identify the test. The returned name should as unique as possible to > identify the test (that why the TestCase name is included by the > TestSuiteBuilder). TestRunners rely on that name to run a specified test (or > suite). Having a name that identify the test without ambiguity help reading > the failures report (you don't have to bother with the filename). > > Conclusion: ditch either toString() or getName(). I find that getName() as a > more intention revealing name ;-) I agree with your conclusion. And I volunteer to do it (remove toString). My plan of attack is as follows: 1. Remove all use of toString() in the library. 2. Document toString() as deprecated in all classes that define it. 3. Replace all toString() implementations with "return getName()". 4. After a respectable number of public releases have been made, remove all toString() methods. Optionally, we could replace toString() methods with toString() { std::cerr << "Replace toString() with getName()." << endl; return getName(); } ... or would that be too obnoxious? ;-) Comments? -Steve -- by Rocket to the Moon, by Airplane to the Rocket, by Taxi to the Airport, by Frontdoor to the Taxi, by throwing back the blanket and laying down the legs ... - They Might Be Giants |