summaryrefslogtreecommitdiff
path: root/src/cppunit
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-03 06:02:49 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-03 06:02:49 +0000
commitad45759ab7a47c7a7932f7e6be66f3ea106b643b (patch)
tree827097bba87b959981cc3676f0e4d90630649c0b /src/cppunit
parentd8e61dcb0fd9046b44ca3e9e6868b5429eee8aa9 (diff)
downloadcppunit-ad45759ab7a47c7a7932f7e6be66f3ea106b643b.tar.gz
Include/cppunit/XmlOutputter.
include/cppunit/XmlOutputter.h: fixed XmlOutputter constructed default value initializatino which caused compilation error with BC5. * src/cppunit/PlugInManager.cpp: added missing CPPUNIT_NO_TESTPLUGIN guard. * src/msvc6/testrunner/TestRunner.dsp: * src/msvc6/testrunner/TestRunner.rc: * src/msvc6/testrunner/TestRunnerDlg.cpp: * src/msvc6/testrunner/TestRunnerDlg.h: * src/msvc6/testrunner/TreeHierarchyDlg.cpp: * src/msvc6/testrunner/TreeHierarchyDlg.h: * src/msvc6/testpluginrunner/TestPlugInRunner.dsp: * src/msvc6/testpluginrunner/TestPlugInRunner.rc: * src/msvc6/testpluginrunner/TestPlugInRunnerApp.cpp: * src/msvc6/testpluginrunner/TestPlugInRunnerDlg.cpp: * src/msvc6/testpluginrunner/TestPlugInRunnerDlg.h: applied Steven Mitter patch to fix bug #530426 (conflict between TestRunner and host application resources). Adapted patch to compile work with Unicode. * src/msvc6/testrunner/ResourceLoaders.h: * src/msvc6/testrunner/ResourceLoaders.cpp: * src/msvc6/testrunner/Change-Diary-ResourceBugFix.txt: added, from Steven Mitter's patch. Simplified loadCString() to compile with Unicode. * src/cppunit/cppunit.dsp: * src/cppunit/cppunit_dll.dsp: * src/DllPlugInTester/DllPlugInTester.dsp: * src/msvc6/testrunner/TestRunner.dsp: * src/msvc6/testpluginrunner/TestPlugInRunner.dsp: all lib, dll and exe are now created in the intermediate directory. A post-build rule is used to copy them to the lib/ directory.
Diffstat (limited to 'src/cppunit')
-rw-r--r--src/cppunit/Asserter.cpp59
-rw-r--r--src/cppunit/BeOsDynamicLibraryManager.cpp7
-rw-r--r--src/cppunit/CompilerOutputter.cpp2
-rw-r--r--src/cppunit/DynamicLibraryManager.cpp10
-rw-r--r--src/cppunit/DynamicLibraryManagerException.cpp29
-rw-r--r--src/cppunit/Makefile.am3
-rw-r--r--src/cppunit/PlugInManager.cpp5
-rw-r--r--src/cppunit/TestPlugInDefaultImpl.cpp2
-rw-r--r--src/cppunit/UnixDynamicLibraryManager.cpp7
-rw-r--r--src/cppunit/Win32DynamicLibraryManager.cpp28
-rw-r--r--src/cppunit/cppunit.dsp26
-rw-r--r--src/cppunit/cppunit_dll.dsp36
12 files changed, 159 insertions, 55 deletions
diff --git a/src/cppunit/Asserter.cpp b/src/cppunit/Asserter.cpp
index e43c19b..0b64f4f 100644
--- a/src/cppunit/Asserter.cpp
+++ b/src/cppunit/Asserter.cpp
@@ -10,7 +10,6 @@ namespace CppUnit
namespace Asserter
{
-
void
fail( std::string message,
const SourceLine &sourceLine )
@@ -46,31 +45,32 @@ failIf( bool shouldFail,
}
-void
-failNotEqual( std::string expected,
- std::string actual,
- const SourceLine &sourceLine,
- const Message &additionalMessage,
- std::string shortDescription )
+std::string
+makeExpected( const std::string &expectedValue )
{
- Message message( shortDescription,
- "Expected: " + expected,
- "Actual : " + actual );
- message.addDetail( additionalMessage );
- fail( message, sourceLine );
+ return "Expected: " + expectedValue;
}
-void
-failNotEqualIf( bool shouldFail,
- std::string expected,
- std::string actual,
- const SourceLine &sourceLine,
- const Message &additionalMessage,
- std::string shortDescription )
+std::string
+makeActual( const std::string &actualValue )
{
- if ( shouldFail )
- failNotEqual( expected, actual, sourceLine, additionalMessage, shortDescription );
+ return "Actual : " + actualValue;
+}
+
+
+Message
+makeNotEqualMessage( const std::string &expectedValue,
+ const std::string &actualValue,
+ const AdditionalMessage &additionalMessage,
+ const std::string &shortDescription )
+{
+ Message message( shortDescription,
+ makeExpected( expectedValue ),
+ makeActual( actualValue ) );
+ message.addDetail( additionalMessage );
+
+ return message;
}
@@ -78,12 +78,14 @@ void
failNotEqual( std::string expected,
std::string actual,
const SourceLine &sourceLine,
- std::string additionalMessage )
+ const AdditionalMessage &additionalMessage,
+ std::string shortDescription )
{
- Message message;
- if ( !additionalMessage.empty() )
- message.addDetail( additionalMessage );
- failNotEqual( expected, actual, sourceLine, message );
+ fail( makeNotEqualMessage( expected,
+ actual,
+ additionalMessage,
+ shortDescription ),
+ sourceLine );
}
@@ -92,10 +94,11 @@ failNotEqualIf( bool shouldFail,
std::string expected,
std::string actual,
const SourceLine &sourceLine,
- std::string additionalMessage )
+ const AdditionalMessage &additionalMessage,
+ std::string shortDescription )
{
if ( shouldFail )
- failNotEqual( expected, actual, sourceLine, additionalMessage );
+ failNotEqual( expected, actual, sourceLine, additionalMessage, shortDescription );
}
diff --git a/src/cppunit/BeOsDynamicLibraryManager.cpp b/src/cppunit/BeOsDynamicLibraryManager.cpp
index bdf6c7a..30ff126 100644
--- a/src/cppunit/BeOsDynamicLibraryManager.cpp
+++ b/src/cppunit/BeOsDynamicLibraryManager.cpp
@@ -37,6 +37,13 @@ DynamicLibraryManager::doFindSymbol( const std::string &symbol )
}
+std::string
+DynamicLibraryManager::getLastErrorDetail() const
+{
+ return "";
+}
+
+
} // namespace CppUnit
diff --git a/src/cppunit/CompilerOutputter.cpp b/src/cppunit/CompilerOutputter.cpp
index 4628d4c..c394aff 100644
--- a/src/cppunit/CompilerOutputter.cpp
+++ b/src/cppunit/CompilerOutputter.cpp
@@ -16,7 +16,7 @@ CompilerOutputter::CompilerOutputter( TestResultCollector *result,
: m_result( result )
, m_stream( stream )
, m_locationFormat( locationFormat )
- , m_wrapColumn( 79 )
+ , m_wrapColumn( CPPUNIT_WRAP_COLUMN )
{
}
diff --git a/src/cppunit/DynamicLibraryManager.cpp b/src/cppunit/DynamicLibraryManager.cpp
index 00e97f8..2f281ef 100644
--- a/src/cppunit/DynamicLibraryManager.cpp
+++ b/src/cppunit/DynamicLibraryManager.cpp
@@ -34,7 +34,9 @@ DynamicLibraryManager::findSymbol( const std::string &symbol )
{
}
- throw DynamicLibraryManagerException( m_libraryName, symbol );
+ throw DynamicLibraryManagerException( m_libraryName,
+ symbol,
+ DynamicLibraryManagerException::symbolNotFound );
return NULL; // keep compiler happy
}
@@ -45,7 +47,7 @@ DynamicLibraryManager::loadLibrary( const std::string &libraryName )
try
{
releaseLibrary();
- m_libraryHandle = doLoadLibrary( libraryName );
+ m_libraryHandle = doLoadLibrary( libraryName );
if ( m_libraryHandle != NULL )
return;
}
@@ -53,7 +55,9 @@ DynamicLibraryManager::loadLibrary( const std::string &libraryName )
{
}
- throw DynamicLibraryManagerException( m_libraryName );
+ throw DynamicLibraryManagerException( m_libraryName,
+ getLastErrorDetail(),
+ DynamicLibraryManagerException::loadingFailed );
}
diff --git a/src/cppunit/DynamicLibraryManagerException.cpp b/src/cppunit/DynamicLibraryManagerException.cpp
index 44a7e62..a5f133b 100644
--- a/src/cppunit/DynamicLibraryManagerException.cpp
+++ b/src/cppunit/DynamicLibraryManagerException.cpp
@@ -7,27 +7,32 @@ namespace CppUnit
DynamicLibraryManagerException::DynamicLibraryManagerException(
- const std::string &libraryName )
- : m_cause( loadingFailed )
- , std::runtime_error( "Failed to load dynamic library: " + libraryName )
+ const std::string &libraryName,
+ const std::string &errorDetail,
+ Cause cause )
+ : m_cause( cause )
+ , std::runtime_error( "" )
{
+ if ( cause == loadingFailed )
+ m_message = "Failed to load dynamic library: " + libraryName + "\n" +
+ errorDetail;
+ else
+ m_message = "Symbol [" + errorDetail + "] not found in dynamic libary:" +
+ libraryName;
}
-DynamicLibraryManagerException::DynamicLibraryManagerException(
- const std::string &libraryName,
- const std::string &symbol )
- : m_cause( symbolNotFound )
- , std::runtime_error( "Symbol [" + symbol + "] not found in dynamic libary:" +
- libraryName )
+DynamicLibraryManagerException::Cause
+DynamicLibraryManagerException::getCause() const
{
+ return m_cause;
}
-DynamicLibraryManagerException::Cause
-DynamicLibraryManagerException::getCause() const
+const char *
+DynamicLibraryManagerException::what() const throw()
{
- return m_cause;
+ return m_message.c_str();
}
diff --git a/src/cppunit/Makefile.am b/src/cppunit/Makefile.am
index 3846e64..6dd72e2 100644
--- a/src/cppunit/Makefile.am
+++ b/src/cppunit/Makefile.am
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.am,v 1.35 2002-06-14 20:21:00 blep Exp $
+# $Id: Makefile.am,v 1.36 2002-07-03 07:02:49 blep Exp $
#
EXTRA_DIST = cppunit.dsp cppunit_dll.dsp DllMain.cpp
@@ -8,6 +8,7 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
lib_LTLIBRARIES = libcppunit.la
libcppunit_la_SOURCES = \
+ AdditionalMessage.cpp \
Asserter.cpp \
BeOsDynamicLibraryManager.cpp \
BriefTestProgressListener.cpp \
diff --git a/src/cppunit/PlugInManager.cpp b/src/cppunit/PlugInManager.cpp
index 8f2476d..35312e4 100644
--- a/src/cppunit/PlugInManager.cpp
+++ b/src/cppunit/PlugInManager.cpp
@@ -1,6 +1,8 @@
#include <cppunit/XmlOutputterHook.h>
-#include <cppunit/plugin/PlugInManager.h>
+
+#if !defined(CPPUNIT_NO_TESTPLUGIN)
#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/plugin/PlugInManager.h>
#include <cppunit/plugin/TestPlugIn.h>
#include <cppunit/plugin/DynamicLibraryManager.h>
@@ -106,3 +108,4 @@ PlugInManager::removeXmlOutputterHooks()
} // namespace CppUnit
+#endif // !defined(CPPUNIT_NO_TESTPLUGIN)
diff --git a/src/cppunit/TestPlugInDefaultImpl.cpp b/src/cppunit/TestPlugInDefaultImpl.cpp
index 55010ed..cd7cc98 100644
--- a/src/cppunit/TestPlugInDefaultImpl.cpp
+++ b/src/cppunit/TestPlugInDefaultImpl.cpp
@@ -2,8 +2,8 @@
#if !defined(CPPUNIT_NO_TESTPLUGIN)
-#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestSuite.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/plugin/TestPlugInDefaultImpl.h>
diff --git a/src/cppunit/UnixDynamicLibraryManager.cpp b/src/cppunit/UnixDynamicLibraryManager.cpp
index 74066f7..1d27590 100644
--- a/src/cppunit/UnixDynamicLibraryManager.cpp
+++ b/src/cppunit/UnixDynamicLibraryManager.cpp
@@ -32,6 +32,13 @@ DynamicLibraryManager::doFindSymbol( const std::string &symbol )
}
+std::string
+DynamicLibraryManager::getLastErrorDetail() const
+{
+ return "";
+}
+
+
} // namespace CppUnit
diff --git a/src/cppunit/Win32DynamicLibraryManager.cpp b/src/cppunit/Win32DynamicLibraryManager.cpp
index 2c4ec03..249d692 100644
--- a/src/cppunit/Win32DynamicLibraryManager.cpp
+++ b/src/cppunit/Win32DynamicLibraryManager.cpp
@@ -37,6 +37,34 @@ DynamicLibraryManager::doFindSymbol( const std::string &symbol )
}
+std::string
+DynamicLibraryManager::getLastErrorDetail() const
+{
+ LPVOID lpMsgBuf;
+ ::FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpMsgBuf,
+ 0,
+ NULL
+ );
+
+ std::string message = (LPCTSTR)lpMsgBuf;
+
+ // Display the string.
+// ::MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
+
+ // Free the buffer.
+ ::LocalFree( lpMsgBuf );
+
+ return message;
+}
+
+
} // namespace CppUnit
diff --git a/src/cppunit/cppunit.dsp b/src/cppunit/cppunit.dsp
index 2111bbd..dd6130f 100644
--- a/src/cppunit/cppunit.dsp
+++ b/src/cppunit/cppunit.dsp
@@ -49,7 +49,14 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\lib\cppunit.lib"
+# ADD LIB32 /nologo
+# Begin Special Build Tool
+TargetPath=.\Release\cppunit.lib
+TargetName=cppunit
+SOURCE="$(InputPath)"
+PostBuild_Desc=Copying target to lib/
+PostBuild_Cmds=copy $(TargetPath) ..\..\lib\$(TargetName).lib
+# End Special Build Tool
!ELSEIF "$(CFG)" == "cppunit - Win32 Debug"
@@ -72,7 +79,14 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\lib\cppunitd.lib"
+# ADD LIB32 /nologo /out:"Debug\cppunitd.lib"
+# Begin Special Build Tool
+TargetPath=.\Debug\cppunitd.lib
+TargetName=cppunitd
+SOURCE="$(InputPath)"
+PostBuild_Desc=Copying target to lib/
+PostBuild_Cmds=copy $(TargetPath) ..\..\lib\$(TargetName).lib
+# End Special Build Tool
!ENDIF
@@ -245,6 +259,14 @@ SOURCE=..\..\include\cppunit\XmlOutputterHook.h
# PROP Default_Filter ""
# Begin Source File
+SOURCE=.\AdditionalMessage.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\AdditionalMessage.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Asserter.cpp
# End Source File
# Begin Source File
diff --git a/src/cppunit/cppunit_dll.dsp b/src/cppunit/cppunit_dll.dsp
index 4ab8bab..acef366 100644
--- a/src/cppunit/cppunit_dll.dsp
+++ b/src/cppunit/cppunit_dll.dsp
@@ -38,8 +38,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "ReleaseDLL"
-# PROP Intermediate_Dir "ReleaseDLL"
+# PROP Output_Dir "ReleaseDll"
+# PROP Intermediate_Dir "ReleaseDll"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPPUNIT_DLL_EXPORTS" /YX /FD /c
@@ -53,8 +53,16 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"..\..\lib\cppunit_dll.pdb" /machine:I386 /out:"..\..\lib\cppunit_dll.dll" /implib:"..\..\lib\cppunit_dll.lib"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"..\..\lib\cppunit_dll.pdb" /machine:I386
# SUBTRACT LINK32 /pdb:none
+# Begin Special Build Tool
+TargetDir=.\ReleaseDll
+TargetPath=.\ReleaseDll\cppunit_dll.dll
+TargetName=cppunit_dll
+SOURCE="$(InputPath)"
+PostBuild_Desc=Copying target to lib/
+PostBuild_Cmds=copy $(TargetPath) ..\..\lib\$(TargetName).dll copy $(TargetDir)\$(TargetName).lib ..\..\lib\$(TargetName).lib
+# End Special Build Tool
!ELSEIF "$(CFG)" == "cppunit_dll - Win32 Debug"
@@ -65,8 +73,8 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "DebugDLL"
-# PROP Intermediate_Dir "DebugDLL"
+# PROP Output_Dir "DebugDll"
+# PROP Intermediate_Dir "DebugDll"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPPUNIT_DLL_EXPORTS" /YX /FD /GZ /c
@@ -81,8 +89,16 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"..\..\lib\cppunitd_dll.pdb" /debug /machine:I386 /out:"..\..\lib\cppunitd_dll.dll" /implib:"..\..\lib\cppunitd_dll.lib" /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"..\..\lib\cppunitd_dll.pdb" /debug /machine:I386 /out:"DebugDll\cppunitd_dll.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
+# Begin Special Build Tool
+TargetDir=.\DebugDll
+TargetPath=.\DebugDll\cppunitd_dll.dll
+TargetName=cppunitd_dll
+SOURCE="$(InputPath)"
+PostBuild_Desc=Copying target to lib/
+PostBuild_Cmds=copy $(TargetPath) ..\..\lib\$(TargetName).dll copy $(TargetDir)\$(TargetName).lib ..\..\lib\$(TargetName).lib
+# End Special Build Tool
!ENDIF
@@ -183,6 +199,14 @@ SOURCE=..\..\include\cppunit\extensions\TypeInfoHelper.h
# PROP Default_Filter ""
# Begin Source File
+SOURCE=.\AdditionalMessage.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\AdditionalMessage.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Asserter.cpp
# End Source File
# Begin Source File