summaryrefslogtreecommitdiff
path: root/include/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 /include/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 'include/cppunit')
-rw-r--r--include/cppunit/Asserter.h63
-rw-r--r--include/cppunit/Makefile.am1
-rw-r--r--include/cppunit/Portability.h6
-rw-r--r--include/cppunit/XmlOutputter.h2
-rw-r--r--include/cppunit/plugin/DynamicLibraryManager.h10
-rw-r--r--include/cppunit/plugin/DynamicLibraryManagerException.h11
6 files changed, 54 insertions, 39 deletions
diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h
index fd7eb9b..45cd4b7 100644
--- a/include/cppunit/Asserter.h
+++ b/include/cppunit/Asserter.h
@@ -1,7 +1,7 @@
#ifndef CPPUNIT_ASSERTER_H
#define CPPUNIT_ASSERTER_H
-#include <cppunit/Portability.h>
+#include <cppunit/AdditionalMessage.h>
#include <cppunit/SourceLine.h>
#include <string>
@@ -44,7 +44,6 @@ class Message;
*/
namespace Asserter
{
-
/*! Throws a Exception with the specified message and location.
*/
void CPPUNIT_API fail( const Message &message,
@@ -77,6 +76,33 @@ namespace Asserter
std::string message,
const SourceLine &sourceLine = SourceLine() );
+ /*! \brief Returns a expected value string for a message.
+ * Typically used to create 'not equal' message, or to check that a message
+ * contains the expected content when writing unit tests for your custom
+ * assertions.
+ *
+ * \param expectedValue String that represents the expected value.
+ * \return \a expectedValue prefixed with "Expected: ".
+ * \see makeActual().
+ */
+ std::string CPPUNIT_API makeExpected( const std::string &expectedValue );
+
+ /*! \brief Returns an actual value string for a message.
+ * Typically used to create 'not equal' message, or to check that a message
+ * contains the expected content when writing unit tests for your custom
+ * assertions.
+ *
+ * \param actualValue String that represents the actual value.
+ * \return \a actualValue prefixed with "Actual : ".
+ * \see makeExpected().
+ */
+ std::string CPPUNIT_API makeActual( const std::string &actualValue );
+
+ Message CPPUNIT_API makeNotEqualMessage( const std::string &expectedValue,
+ const std::string &actualValue,
+ const AdditionalMessage &additionalMessage = AdditionalMessage(),
+ const std::string &shortDescription = "equality assertion failed");
+
/*! Throws an Exception with the specified message and location.
* \param expected Text describing the expected value.
* \param actual Text describing the actual value.
@@ -87,7 +113,7 @@ namespace Asserter
void CPPUNIT_API failNotEqual( std::string expected,
std::string actual,
const SourceLine &sourceLine,
- const Message &additionalMessage,
+ const AdditionalMessage &additionalMessage = AdditionalMessage(),
std::string shortDescription = "equality assertion failed" );
/*! Throws an Exception with the specified message and location.
@@ -103,38 +129,9 @@ namespace Asserter
std::string expected,
std::string actual,
const SourceLine &sourceLine,
- const Message &additionalMessage,
+ const AdditionalMessage &additionalMessage = AdditionalMessage(),
std::string shortDescription = "equality assertion failed" );
- /*! Throws an Exception with the specified message and location.
- * \deprecated Use failNotEqual( std::string, std::string, SourceLine, Message, std::string ) instead.
- * \param expected Text describing the expected value.
- * \param actual Text describing the actual value.
- * \param additionalMessage Additional message. Usually used to report
- * where the "difference" is located.
- * \param sourceLine Location of the assertion.
- */
- void CPPUNIT_API failNotEqual( std::string expected,
- std::string actual,
- const SourceLine &sourceLine = SourceLine(),
- std::string additionalMessage ="" );
-
- /*! Throws an Exception with the specified message and location.
- * \deprecated Use failNotEqualIf( bool, std::string, std::string, SourceLine, Message, std::string ) instead.
- * \param shouldFail if \c true then the exception is thrown. Otherwise
- * nothing happen.
- * \param expected Text describing the expected value.
- * \param actual Text describing the actual value.
- * \param additionalMessage Additional message. Usually used to report
- * where the "difference" is located.
- * \param sourceLine Location of the assertion.
- */
- void CPPUNIT_API failNotEqualIf( bool shouldFail,
- std::string expected,
- std::string actual,
- const SourceLine &sourceLine = SourceLine(),
- std::string additionalMessage ="" );
-
} // namespace Asserter
} // namespace CppUnit
diff --git a/include/cppunit/Makefile.am b/include/cppunit/Makefile.am
index 3c7930a..adca29f 100644
--- a/include/cppunit/Makefile.am
+++ b/include/cppunit/Makefile.am
@@ -5,6 +5,7 @@ DISTCLEANFILES = config-auto.h
libcppunitincludedir = $(includedir)/cppunit
libcppunitinclude_HEADERS = \
config-auto.h \
+ AdditionalMessage.h \
Asserter.h \
BriefTestProgressListener.h \
CompilerOutputter.h \
diff --git a/include/cppunit/Portability.h b/include/cppunit/Portability.h
index d5cfc5e..c684eb7 100644
--- a/include/cppunit/Portability.h
+++ b/include/cppunit/Portability.h
@@ -92,6 +92,12 @@
*/
#define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, __LINE__ )
+/*! Defines wrap colunm for %CppUnit. Used by CompilerOuputter.
+ */
+#ifndef CPPUNIT_WRAP_COLUMN
+#define CPPUNIT_WRAP_COLUMN 79
+#endif
+
/* perform portability hacks */
diff --git a/include/cppunit/XmlOutputter.h b/include/cppunit/XmlOutputter.h
index 190ed70..bae2dac 100644
--- a/include/cppunit/XmlOutputter.h
+++ b/include/cppunit/XmlOutputter.h
@@ -46,7 +46,7 @@ public:
*/
XmlOutputter( TestResultCollector *result,
std::ostream &stream,
- std::string encoding = "ISO-8859-1" );
+ std::string encoding = std::string("ISO-8859-1") );
/// Destructor.
virtual ~XmlOutputter();
diff --git a/include/cppunit/plugin/DynamicLibraryManager.h b/include/cppunit/plugin/DynamicLibraryManager.h
index 2a95f30..3b4f30b 100644
--- a/include/cppunit/plugin/DynamicLibraryManager.h
+++ b/include/cppunit/plugin/DynamicLibraryManager.h
@@ -92,6 +92,16 @@ private:
*/
Symbol doFindSymbol( const std::string &symbol );
+ /*! Returns detailed information about doLoadLibrary() failure.
+ *
+ * Called just after a failed call to doLoadLibrary() to get extra
+ * error information.
+ *
+ * \return Detailed information about the failure of the call to
+ * doLoadLibrary() that just failed.
+ */
+ std::string getLastErrorDetail() const;
+
/// Prevents the use of the copy constructor.
DynamicLibraryManager( const DynamicLibraryManager &copy );
diff --git a/include/cppunit/plugin/DynamicLibraryManagerException.h b/include/cppunit/plugin/DynamicLibraryManagerException.h
index 260df21..e0a1283 100644
--- a/include/cppunit/plugin/DynamicLibraryManagerException.h
+++ b/include/cppunit/plugin/DynamicLibraryManagerException.h
@@ -27,16 +27,17 @@ public:
symbolNotFound
};
- /// Failed to load the dynamic library
- DynamicLibraryManagerException( const std::string &libraryName );
-
- /// Symbol not found in the dynamic library
+ /// Failed to load the dynamic library or Symbol not found in the dynamic library.
DynamicLibraryManagerException( const std::string &libraryName,
- const std::string &symbol );
+ const std::string &errorDetail,
+ Cause cause );
Cause getCause() const;
+ const char *what() const throw();
+
private:
+ std::string m_message;
Cause m_cause;
};