Thread: [Cppunit-cvs] cppunit2/src/cpput assert.cpp,1.7,1.8 dllproxy.cpp,1.2,1.3 exceptionguard.cpp,1.1,1.2
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-02-27 10:17:15
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2955/src/cpput Modified Files: assert.cpp dllproxy.cpp exceptionguard.cpp properties.cpp registry.cpp testcase.cpp testinfo.cpp testsuite.cpp Log Message: * use CppTL::ConstString instead of std::string for thread-safety Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** assert.cpp 21 Nov 2004 22:28:54 -0000 1.7 --- assert.cpp 27 Feb 2005 10:17:05 -0000 1.8 *************** *** 54,58 **** Message newMessage( translate( "Assertion expression did not fail as expected." ) ); ! newMessage.add( message ); fail( message ); } --- 54,58 ---- Message newMessage( translate( "Assertion expression did not fail as expected." ) ); ! newMessage.extend( message ); fail( message ); } *************** *** 67,71 **** Message newMessage( translate( "Assertion expression did not pass as expected." ) ); ! newMessage.add( message ); fail( message ); } --- 67,71 ---- Message newMessage( translate( "Assertion expression did not pass as expected." ) ); ! newMessage.extend( message ); fail( message ); } *************** *** 73,78 **** Message ! buildEqualityFailedMessage( const std::string &expected, ! const std::string &actual, const Message &message ) { --- 73,78 ---- Message ! buildEqualityFailedMessage( const CppTL::ConstString &expected, ! const CppTL::ConstString &actual, const Message &message ) { *************** *** 86,91 **** Message ! buildUnequalityFailedMessage( const std::string &expected, ! const std::string &actual, const Message &message ) { --- 86,91 ---- Message ! buildUnequalityFailedMessage( const CppTL::ConstString &expected, ! const CppTL::ConstString &actual, const Message &message ) { Index: registry.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/registry.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** registry.cpp 27 Jan 2004 20:34:35 -0000 1.1.1.1 --- registry.cpp 27 Feb 2005 10:17:05 -0000 1.2 *************** *** 7,11 **** ! std::string Registry::defaultParentSuiteName() { --- 7,11 ---- ! CppTL::ConstString Registry::defaultParentSuiteName() { *************** *** 29,34 **** void ! Registry::addChild( const std::string &parentSuiteName, ! const std::string &childSuiteName ) { // ParentChildRelationShips::iterator it = relations_.find( childSuiteName ); --- 29,34 ---- void ! Registry::addChild( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ) { // ParentChildRelationShips::iterator it = relations_.find( childSuiteName ); *************** *** 40,45 **** bool ! Registry::removeChild( const std::string &parentSuiteName, ! const std::string &childSuiteName ) { ParentChildRelationShips::iterator it = relations_.find( parentSuiteName ); --- 40,45 ---- bool ! Registry::removeChild( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ) { ParentChildRelationShips::iterator it = relations_.find( parentSuiteName ); *************** *** 57,61 **** TestFactoryId ! Registry::add( const std::string &parentSuiteName, const TestFactory &testFactory ) { --- 57,61 ---- TestFactoryId ! Registry::add( const CppTL::ConstString &parentSuiteName, const TestFactory &testFactory ) { *************** *** 81,85 **** return false; ! std::string parentSuiteName = parentIt->second; TestFactoryRegistry::iterator itRegistry = registry_.find( parentSuiteName ); if ( itRegistry == registry_.end() ) --- 81,85 ---- return false; ! CppTL::ConstString parentSuiteName = parentIt->second; TestFactoryRegistry::iterator itRegistry = registry_.find( parentSuiteName ); if ( itRegistry == registry_.end() ) *************** *** 107,111 **** /* void ! Registry::destroy( const std::string &suiteName ) { registry_.erase( suiteName ); --- 107,111 ---- /* void ! Registry::destroy( const CppTL::ConstString &suiteName ) { registry_.erase( suiteName ); *************** *** 123,127 **** TestSuitePtr ! Registry::createTests( const std::string &suiteName ) const { if ( suiteName == defaultParentSuiteName() ) --- 123,127 ---- TestSuitePtr ! Registry::createTests( const CppTL::ConstString &suiteName ) const { if ( suiteName == defaultParentSuiteName() ) *************** *** 144,148 **** void ! Registry::addCreatedTests( const std::string &suiteName, const TestSuitePtr &suite ) const { --- 144,148 ---- void ! Registry::addCreatedTests( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const { *************** *** 153,157 **** void ! Registry::addChildSuite( const std::string &suiteName, const TestSuitePtr &suite ) const { --- 153,157 ---- void ! Registry::addChildSuite( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const { *************** *** 160,164 **** while ( itChild != itChildEnd ) { ! const std::string &childSuiteName = itChild->second; suite->add( createTests( childSuiteName ) ); ++itChild; --- 160,164 ---- while ( itChild != itChildEnd ) { ! const CppTL::ConstString &childSuiteName = itChild->second; suite->add( createTests( childSuiteName ) ); ++itChild; *************** *** 168,172 **** void ! Registry::addSuiteRegisteredTests( const std::string &suiteName, const TestSuitePtr &suite ) const { --- 168,172 ---- void ! Registry::addSuiteRegisteredTests( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const { Index: exceptionguard.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/exceptionguard.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** exceptionguard.cpp 22 Feb 2005 21:26:49 -0000 1.1 --- exceptionguard.cpp 27 Feb 2005 10:17:05 -0000 1.2 *************** *** 84,88 **** private: ! void addFault( const std::string &exceptionType, const char *what ) { --- 84,88 ---- private: ! void addFault( const CppTL::ConstString &exceptionType, const char *what ) { Index: testcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcase.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** testcase.cpp 22 Feb 2005 21:26:49 -0000 1.8 --- testcase.cpp 27 Feb 2005 10:17:05 -0000 1.9 *************** *** 15,19 **** ! AbstractTestCase::AbstractTestCase( const std::string &name ) : Test( name ) { --- 15,19 ---- ! AbstractTestCase::AbstractTestCase( const CppTL::ConstString &name ) : Test( name ) { *************** *** 75,79 **** TestCase::TestCase( const Functor0 &run, ! const std::string &name ) : AbstractTestCase( name ) , run_( run ) --- 75,79 ---- TestCase::TestCase( const Functor0 &run, ! const CppTL::ConstString &name ) : AbstractTestCase( name ) , run_( run ) *************** *** 85,89 **** const Functor0 &run, const Functor0 &tearDown, ! const std::string &name ) : AbstractTestCase( name ) , setUp_( setUp ) --- 85,89 ---- const Functor0 &run, const Functor0 &tearDown, ! const CppTL::ConstString &name ) : AbstractTestCase( name ) , setUp_( setUp ) *************** *** 120,124 **** TestPtr makeTestCase( const Functor0 &run, ! const std::string &name ) { return TestPtr( new TestCase( run, name ) ); --- 120,124 ---- TestPtr makeTestCase( const Functor0 &run, ! const CppTL::ConstString &name ) { return TestPtr( new TestCase( run, name ) ); *************** *** 129,133 **** const Functor0 &run, const Functor0 &tearDown, ! const std::string &name ) { return TestPtr( new TestCase( setUp, run, tearDown, name ) ); --- 129,133 ---- const Functor0 &run, const Functor0 &tearDown, ! const CppTL::ConstString &name ) { return TestPtr( new TestCase( setUp, run, tearDown, name ) ); *************** *** 140,144 **** { public: ! FailingTestCase( const std::string &name, const CppUT::Message &message ) : CppUT::AbstractTestCase( name ) --- 140,144 ---- { public: ! FailingTestCase( const CppTL::ConstString &name, const CppUT::Message &message ) : CppUT::AbstractTestCase( name ) *************** *** 157,161 **** ! TestPtr CPPUT_API makeFailingTestCase( const std::string &name, const Message &message ) { --- 157,161 ---- ! TestPtr CPPUT_API makeFailingTestCase( const CppTL::ConstString &name, const Message &message ) { Index: dllproxy.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/dllproxy.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dllproxy.cpp 14 Jun 2004 23:25:06 -0000 1.2 --- dllproxy.cpp 27 Feb 2005 10:17:05 -0000 1.3 *************** *** 72,77 **** } ! throw DllProxyError( translate( "Failed to load dynamic library: " ) + path + "\n" + ! getLastErrorDetail() ); } --- 72,78 ---- } ! CppTL::ConstString message = translate( "Failed to load dynamic library: " ) ! + path + "\n" + getLastErrorDetail(); ! throw DllProxyError( message.c_str() ); } Index: testsuite.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testsuite.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testsuite.cpp 20 Nov 2004 15:26:38 -0000 1.5 --- testsuite.cpp 27 Feb 2005 10:17:05 -0000 1.6 *************** *** 14,18 **** ! AbstractTestSuite::AbstractTestSuite( const std::string &name ) : Test( name ) { --- 14,18 ---- ! AbstractTestSuite::AbstractTestSuite( const CppTL::ConstString &name ) : Test( name ) { *************** *** 37,41 **** // //////////////////////////////////////////////////////////////////// ! TestSuite::TestSuite( const std::string &name ) : AbstractTestSuite( name ) { --- 37,41 ---- // //////////////////////////////////////////////////////////////////// ! TestSuite::TestSuite( const CppTL::ConstString &name ) : AbstractTestSuite( name ) { *************** *** 75,79 **** ! TestSuitePtr makeTestSuite( const std::string &name ) { return TestSuitePtr( new TestSuite( name ) ); --- 75,79 ---- ! TestSuitePtr makeTestSuite( const CppTL::ConstString &name ) { return TestSuitePtr( new TestSuite( name ) ); Index: properties.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/properties.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** properties.cpp 21 Nov 2004 22:26:32 -0000 1.6 --- properties.cpp 27 Feb 2005 10:17:05 -0000 1.7 *************** *** 84,88 **** ! Value::Value( const std::string &value ) { guts_.type_ = vtString; --- 84,88 ---- ! Value::Value( const CppTL::ConstString &value ) { guts_.type_ = vtString; *************** *** 272,276 **** } ! std::string Value::asString() const { --- 272,276 ---- } ! CppTL::ConstString Value::asString() const { *************** *** 281,285 **** default: throwBadCast(); ! return std::string(); // keep the compiler happy } } --- 281,285 ---- default: throwBadCast(); ! return CppTL::ConstString(); // keep the compiler happy } } *************** *** 439,443 **** ! std::string Value::toString() const { --- 439,443 ---- ! CppTL::ConstString Value::toString() const { *************** *** 455,459 **** return CppTL::toString( guts_.realValue_ ); case vtString: ! return "'" + asString() + "'"; /// @todo string should be escaped... case vtProperties: return asProperties().toString(); --- 455,459 ---- return CppTL::toString( guts_.realValue_ ); case vtString: ! return CppTL::quoteString( asString() ); case vtProperties: return asProperties().toString(); *************** *** 469,473 **** // ////////////////////////////////////////////////////////////////// ! Property::Property( const std::string &name, const Value &value ) : name_( name ) --- 469,473 ---- // ////////////////////////////////////////////////////////////////// ! Property::Property( const CppTL::ConstString &name, const Value &value ) : name_( name ) *************** *** 477,481 **** ! const std::string & Property::name() const { --- 477,481 ---- ! const CppTL::ConstString & Property::name() const { *************** *** 510,514 **** ! PropertyPath::PropertyPath( const std::string &path, char separator ) { --- 510,514 ---- ! PropertyPath::PropertyPath( const CppTL::ConstString &path, char separator ) { *************** *** 534,538 **** if ( path[index] == separator ) { ! names_.push_back( std::string( path+startIndex, path + index ) ); startIndex = index + 1; } --- 534,538 ---- if ( path[index] == separator ) { ! names_.push_back( CppTL::ConstString( path+startIndex, path + index ) ); startIndex = index + 1; } *************** *** 541,545 **** if ( startIndex < index ) ! names_.push_back( std::string( path+startIndex, path + index ) ); } --- 541,545 ---- if ( startIndex < index ) ! names_.push_back( CppTL::ConstString( path+startIndex, path + index ) ); } *************** *** 553,557 **** PropertyPath & ! PropertyPath::add( const std::string &name ) { names_.push_back( name ); --- 553,557 ---- PropertyPath & ! PropertyPath::add( const CppTL::ConstString &name ) { names_.push_back( name ); *************** *** 587,591 **** ! const std::string & PropertyPath::name() const { --- 587,591 ---- ! const CppTL::ConstString & PropertyPath::name() const { *************** *** 785,789 **** Properties & ! Properties::set( const std::string &name, const Value &value ) { --- 785,789 ---- Properties & ! Properties::set( const CppTL::ConstString &name, const Value &value ) { *************** *** 803,807 **** Properties & ! Properties::setIfNew( const std::string &name, const Value &value ) { --- 803,807 ---- Properties & ! Properties::setIfNew( const CppTL::ConstString &name, const Value &value ) { *************** *** 998,1002 **** Properties::PropertyList::iterator ! Properties::find( const std::string &name ) { PropertyList::iterator it = properties_.begin(); --- 998,1002 ---- Properties::PropertyList::iterator ! Properties::find( const CppTL::ConstString &name ) { PropertyList::iterator it = properties_.begin(); *************** *** 1010,1014 **** Properties::PropertyList::const_iterator ! Properties::find( const std::string &name ) const { PropertyList::const_iterator it = properties_.begin(); --- 1010,1014 ---- Properties::PropertyList::const_iterator ! Properties::find( const CppTL::ConstString &name ) const { PropertyList::const_iterator it = properties_.begin(); *************** *** 1029,1038 **** while ( true ) { ! const std::string &propertyName = names.next(); PropertyList::const_iterator it = properties->find( propertyName ); if ( it == properties->properties_.end() ) { ! throw std::invalid_argument( "OpenTest::Properties: bad property path, '" ! + propertyName + "' is not defined." ); } const Value &value = it->value(); --- 1029,1038 ---- while ( true ) { ! const CppTL::ConstString &propertyName = names.next(); PropertyList::const_iterator it = properties->find( propertyName ); if ( it == properties->properties_.end() ) { ! throw std::invalid_argument( std::string("OpenTest::Properties: bad property path, '") ! + propertyName.c_str() + "' is not defined." ); } const Value &value = it->value(); *************** *** 1054,1058 **** while ( names.hasNext() ) { ! const std::string &propertyName = names.next(); PropertyList::const_iterator it = properties->find( propertyName ); if ( it == properties->properties_.end() ) --- 1054,1058 ---- while ( names.hasNext() ) { ! const CppTL::ConstString &propertyName = names.next(); PropertyList::const_iterator it = properties->find( propertyName ); if ( it == properties->properties_.end() ) *************** *** 1084,1088 **** while ( names.hasNext() ) { ! const std::string &name = names.next(); PropertyList::iterator it = properties->find( name ); if ( it == properties->properties_.end() ) --- 1084,1088 ---- while ( names.hasNext() ) { ! const CppTL::ConstString &name = names.next(); PropertyList::iterator it = properties->find( name ); if ( it == properties->properties_.end() ) *************** *** 1094,1099 **** if ( !it->value().isProperties() ) { ! throw std::invalid_argument( "Properties: invalid path, '" ! + name + "' is not a properties." ); } properties = &(it->value().asProperties()); --- 1094,1099 ---- if ( !it->value().isProperties() ) { ! throw std::invalid_argument( std::string("Properties: invalid path, '") ! + name.c_str() + "' is not a properties." ); } properties = &(it->value().asProperties()); *************** *** 1111,1115 **** ! std::string Properties::toString() const { --- 1111,1115 ---- ! CppTL::ConstString Properties::toString() const { *************** *** 1118,1125 **** ! std::string ! Properties::toString( const std::string &prefix ) const { ! std::string str; PropertyList::const_iterator it = properties_.begin(); PropertyList::const_iterator itEnd = properties_.end(); --- 1118,1125 ---- ! CppTL::ConstString ! Properties::toString( const CppTL::ConstString &prefix ) const { ! CppTL::StringBuffer str; PropertyList::const_iterator it = properties_.begin(); PropertyList::const_iterator itEnd = properties_.end(); *************** *** 1128,1158 **** const Value &value = it->value(); if ( value.isProperties() ) ! str += value.asProperties().toString( prefix + "/" + it->name() ); else ! { ! str += prefix; ! str += "/"; ! str += it->name(); ! str += " = "; ! str += value.toString(); ! str += "\n"; ! } } for ( unsigned int index = 0; index < indexedProperties_.size(); ++index ) { ! std::string localPrefix = prefix; ! localPrefix += "["; ! localPrefix += CppTL::toString( index ); ! localPrefix += "]"; if ( indexedProperties_[index].isProperties() ) str += indexedProperties_[index].asProperties().toString( localPrefix ); else ! { ! str += localPrefix; ! str += " = "; ! str += indexedProperties_[index].toString(); ! str += "\n"; ! } } return str; --- 1128,1143 ---- const Value &value = it->value(); if ( value.isProperties() ) ! str += value.asProperties().toString( prefix+ "/" + it->name() ); else ! str += prefix + "/" + it->name() + " = " + value.toString() + "\n"; } for ( unsigned int index = 0; index < indexedProperties_.size(); ++index ) { ! CppTL::ConstString localPrefix = prefix + "[" + CppTL::toString(index) + "]"; if ( indexedProperties_[index].isProperties() ) str += indexedProperties_[index].asProperties().toString( localPrefix ); else ! str += localPrefix + " = " + indexedProperties_[index].toString() + "\n"; } return str; Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testinfo.cpp 21 Nov 2004 22:22:24 -0000 1.7 --- testinfo.cpp 27 Feb 2005 10:17:05 -0000 1.8 *************** *** 88,92 **** std::string message; if ( abortingAssertionMode_ != fastAbortingAssertion ) ! message = result_.toString(); throw AbortingAssertionException( message ); } --- 88,92 ---- std::string message; if ( abortingAssertionMode_ != fastAbortingAssertion ) ! message = result_.toString().c_str(); throw AbortingAssertionException( message ); } *************** *** 221,225 **** } ! void log( const std::string &text ) { appendToResult( "logs", text ); --- 221,225 ---- } ! void log( const CppTL::ConstString &text ) { appendToResult( "logs", text ); |