diff options
| author | Bastiaan Bakker <bastiaan.bakker@lifeline.nl> | 2001-05-05 22:34:50 +0000 |
|---|---|---|
| committer | Bastiaan Bakker <bastiaan.bakker@lifeline.nl> | 2001-05-05 22:34:50 +0000 |
| commit | b657aa515178205772ab2e95f365bd5a77364610 (patch) | |
| tree | 680d530a1a4c6bbd3dcfa1a867ff608ed1175fa1 /src | |
| parent | a2509e56dd1e457e88d32410d7524a1363f59e96 (diff) | |
| download | cppunit-b657aa515178205772ab2e95f365bd5a77364610.tar.gz | |
Merge of CppUnitW 1.2 phase 2.
Diffstat (limited to 'src')
| -rw-r--r-- | src/cppunit/TestFactoryRegistry.cpp | 25 | ||||
| -rw-r--r-- | src/cppunit/cppunit.dsp | 6 | ||||
| -rw-r--r-- | src/msvc6/testrunner/TestRunner.dsp | 4 | ||||
| -rw-r--r-- | src/msvc6/testrunner/TestRunnerModel.cpp | 2 |
4 files changed, 25 insertions, 12 deletions
diff --git a/src/cppunit/TestFactoryRegistry.cpp b/src/cppunit/TestFactoryRegistry.cpp index 3f390f6..b38cbb4 100644 --- a/src/cppunit/TestFactoryRegistry.cpp +++ b/src/cppunit/TestFactoryRegistry.cpp @@ -9,7 +9,7 @@ #include "cppunit/extensions/TestSuiteBuilder.h" #ifdef USE_TYPEINFO -#include "../TypeInfoHelper.h" +#include "TypeInfoHelper.h" #endif // USE_TYPEINFO namespace CppUnit { @@ -22,6 +22,11 @@ TestFactoryRegistry::TestFactoryRegistry( std::string name ) : TestFactoryRegistry::~TestFactoryRegistry() { + for ( Factories::iterator it = m_factories.begin(); it != m_factories.end(); ++it ) + { + AbstractTestFactory *factory = it->second; + delete factory; + } } @@ -36,14 +41,22 @@ TestFactoryRegistry::getRegistry() TestFactoryRegistry & TestFactoryRegistry::getRegistry( const std::string &name ) { +// No clean-up at the current time => memory leaks. +// Need to find a way to solve the folowing issue: +// getRegistry().registryFactory( "Functionnal", +// getRegistry( "Functionnal" ) ); +// => the test factory registry "Functionnal" would be +// destroyed twice: once by the map below, once by the getRegistry() factory. static NamedRegistries registries; - TestFactoryRegistry*& registryPointer = registries[ name ]; - if (NULL == registryPointer) { - registryPointer = new TestFactoryRegistry( name ); + NamedRegistries::const_iterator foundIt = registries.find( name ); + if ( foundIt == registries.end() ) + { + TestFactoryRegistry *factory = new TestFactoryRegistry( name ); + registries.insert( std::make_pair( name, factory ) ); + return *factory; } - - return *registryPointer; + return *foundIt->second; } diff --git a/src/cppunit/cppunit.dsp b/src/cppunit/cppunit.dsp index 696e3c2..05fa85a 100644 --- a/src/cppunit/cppunit.dsp +++ b/src/cppunit/cppunit.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "..\..\include" /D "_MBCS" /D "_LIB" /D "USE_TYPEINFO" /D "NDEBUG" /D "WIN32" /YX /FD /c # ADD BASE RSC /l 0x40c /d "NDEBUG" # ADD RSC /l 0x40c /d "NDEBUG" BSC32=bscmake.exe @@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\include" /D "_MBCS" /D "_LIB" /D "USE_TYPEINFO" /D "_DEBUG" /D "WIN32" /YX /FD /GZ /c # ADD BASE RSC /l 0x40c /d "_DEBUG" # ADD RSC /l 0x40c /d "_DEBUG" BSC32=bscmake.exe @@ -109,7 +109,7 @@ SOURCE=..\..\include\cppunit\extensions\TestDecorator.h # End Source File # Begin Source File -SOURCE=.\extensions\TestFactoryRegistry.cpp +SOURCE=.\TestFactoryRegistry.cpp # End Source File # Begin Source File diff --git a/src/msvc6/testrunner/TestRunner.dsp b/src/msvc6/testrunner/TestRunner.dsp index 38d2d83..8da75bc 100644 --- a/src/msvc6/testrunner/TestRunner.dsp +++ b/src/msvc6/testrunner/TestRunner.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /D "NDEBUG" /D "USE_TYPEINFO" /D "WIN32" /Yu"stdafx.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" @@ -68,7 +68,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\include\msvc6" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\include\msvc6" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /D "_DEBUG" /D "USE_TYPEINFO" /D "WIN32" /Yu"stdafx.h" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" diff --git a/src/msvc6/testrunner/TestRunnerModel.cpp b/src/msvc6/testrunner/TestRunnerModel.cpp index a910e9c..e728de5 100644 --- a/src/msvc6/testrunner/TestRunnerModel.cpp +++ b/src/msvc6/testrunner/TestRunnerModel.cpp @@ -175,7 +175,7 @@ TestRunnerModel::findTestByNameFor( const std::string &name, if ( suite == NULL ) return NULL; - std::vector<CppUnit::Test *> tests& = suite->getTests(); + const std::vector<CppUnit::Test *> &tests = suite->getTests(); for ( std::vector<CppUnit::Test *>::const_iterator it = tests.begin(); it != tests.end(); ++it ) |
