summaryrefslogtreecommitdiff
path: root/include/cppunit
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-12-02 18:45:54 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-12-02 18:45:54 +0000
commite2b784709cde0cd7040b4bfb3401869c6306bcc0 (patch)
tree01246b777f7300b5d94be5ac0df0d046874da76d /include/cppunit
parentfaa78dac0e46eef7b529b7be7262f4610f04d432 (diff)
downloadcppunit-e2b784709cde0cd7040b4bfb3401869c6306bcc0.tar.gz
Include/cppunit/plugin/DynamicLibraryManagerException.
include/cppunit/plugin/DynamicLibraryManagerException.h: added constructor to fix compilation issues on recents version of gcc and sun CC (bug #619059) * include/cppunit/input/XmlInputHelper.h: added. * include/cppunit/extensions/TestSuiteBuilderContext.h: * src/cppunit/TestSuiteBuilderContext.cpp: added addProperty() and getStringProperty(). Added macros CPPUNIT_TEST_SUITE_PROPERTY. * src/msvc6/testrunner/TestRunnerDlg.cpp: integrated Tim Threlkeld's bug fix #610162: browse button was disabled if history was empty. * src/msvc6/testrunner/DynamicWindow/cdxCSizeIconCtrl.cpp: integrated Tim Threlkeld's bug fix #610191: common control were not initialized. * include/cppunit/extensions/ExceptionTestCaseDecorator.h: bug #603172, missing Message construction. * src/cppunit/DefaultProtector.cpp: bug #603172. Fixed missing ';'. * src/cppunit/TestCase.cpp: bug #603671. Removed unguarded typeinfo include. * examples/cppunittests/*Suite.h: bug #603666. Added missing Portability.h include.
Diffstat (limited to 'include/cppunit')
-rw-r--r--include/cppunit/extensions/ExceptionTestCaseDecorator.h2
-rw-r--r--include/cppunit/extensions/HelperMacros.h11
-rw-r--r--include/cppunit/extensions/TestSuiteBuilderContext.h25
-rw-r--r--include/cppunit/extensions/XmlInputHelper.h23
-rw-r--r--include/cppunit/plugin/DynamicLibraryManagerException.h4
5 files changed, 64 insertions, 1 deletions
diff --git a/include/cppunit/extensions/ExceptionTestCaseDecorator.h b/include/cppunit/extensions/ExceptionTestCaseDecorator.h
index d8d1e82..e8b8aa4 100644
--- a/include/cppunit/extensions/ExceptionTestCaseDecorator.h
+++ b/include/cppunit/extensions/ExceptionTestCaseDecorator.h
@@ -83,7 +83,7 @@ public:
TypeInfoHelper::getClassName(
typeid( ExpectedExceptionType ) ) ) );
#else
- throw Exception( "expected exception not thrown" );
+ throw Exception( Message("expected exception not thrown") );
#endif
}
diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h
index 238fc4e..3f13a3c 100644
--- a/include/cppunit/extensions/HelperMacros.h
+++ b/include/cppunit/extensions/HelperMacros.h
@@ -400,6 +400,17 @@
#define CPPUNIT_TEST_SUITE_ADD_CUSTOM_TESTS( testAdderMethod ) \
testAdderMethod( context )
+/*! \brief Adds a property to the test suite builder context.
+ * \param APropertyKey Key of the property to add.
+ * \param APropertyValue Value for the added property.
+ * Example:
+ * \code
+ * CPPUNIT_TEST_SUITE_PROPERTY("XmlFileName", "paraTest.xml"); \endcode
+ */
+#define CPPUNIT_TEST_SUITE_PROPERTY( APropertyKey, APropertyValue ) \
+ context.addProperty( std::string(APropertyKey), \
+ std::string(APropertyValue) )
+
/** @}
*/
diff --git a/include/cppunit/extensions/TestSuiteBuilderContext.h b/include/cppunit/extensions/TestSuiteBuilderContext.h
index 4fcc8d3..9d42755 100644
--- a/include/cppunit/extensions/TestSuiteBuilderContext.h
+++ b/include/cppunit/extensions/TestSuiteBuilderContext.h
@@ -2,8 +2,14 @@
#define CPPUNIT_HELPER_TESTSUITEBUILDERCONTEXT_H
#include <cppunit/Portability.h>
+#include <cppunit/Portability/CppUnitMap.h>
#include <string>
+#if CPPUNIT_NEED_DLL_DECL
+#pragma warning( push )
+#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
+#endif
+
CPPUNIT_NS_BEGIN
class TestSuite;
@@ -53,12 +59,27 @@ public:
*/
std::string getTestNameFor( const std::string &testMethodName ) const;
+ /*! \brief Adds property pair.
+ * \param key PropertyKey string to add.
+ * \param value PropertyValue string to add.
+ */
+ void addProperty( const std::string &key,
+ const std::string &value );
+
+ /*! \brief Returns property value assigned to param key.
+ * \param key PropertyKey string.
+ */
+ const std::string getStringProperty( const std::string &key ) const;
+
protected:
TestFixture *makeTestFixture() const;
+ typedef CppUnitMap<std::string,std::string> Properties;
+
TestSuite &m_suite;
const TestNamer &m_namer;
TestFixtureFactory &m_factory;
+ Properties m_properties;
};
@@ -93,5 +114,9 @@ public:
CPPUNIT_NS_END
+#if CPPUNIT_NEED_DLL_DECL
+#pragma warning( pop )
+#endif
+
#endif // CPPUNIT_HELPER_TESTSUITEBUILDERCONTEXT_H
diff --git a/include/cppunit/extensions/XmlInputHelper.h b/include/cppunit/extensions/XmlInputHelper.h
new file mode 100644
index 0000000..4f06e5b
--- /dev/null
+++ b/include/cppunit/extensions/XmlInputHelper.h
@@ -0,0 +1,23 @@
+#ifndef CPPUNIT_EXTENSIONS_XMLINPUTHELPER_H
+#define CPPUNIT_EXTENSIONS_XMLINPUTHELPER_H
+
+#include <cppunit/ParameterizedTestCase.h>
+
+
+/*! \brief Adds a parameterized test method to the suite.
+ * \param testMethod Name of the method of the test case to add to the
+ * suite. The signature of the method must be of
+ * type: void testMethod(std::istream& param_in, std::istream& exp_in);
+ * \see CPPUNIT_TEST_SUITE.
+ */
+#define CPPUNIT_TEST_XML( testMethod) \
+ CPPUNIT_TEST_ADD( new CppUnit::ParameterizedTestCase<ThisTestFixtureType>( \
+ context.getTestNameFor( #testMethod ), \
+ #testMethod, \
+ &TestFixtureType::testMethod, \
+ context.makeFixture(), \
+ context.getStringProperty( std::string("XmlFileName") ) ) )
+
+
+
+#endif // CPPUNIT_EXTENSIONS_XMLINPUTHELPER_H \ No newline at end of file
diff --git a/include/cppunit/plugin/DynamicLibraryManagerException.h b/include/cppunit/plugin/DynamicLibraryManagerException.h
index 42e180f..11ebbd9 100644
--- a/include/cppunit/plugin/DynamicLibraryManagerException.h
+++ b/include/cppunit/plugin/DynamicLibraryManagerException.h
@@ -32,6 +32,10 @@ public:
const std::string &errorDetail,
Cause cause );
+ ~DynamicLibraryManagerException() throw()
+ {
+ }
+
Cause getCause() const;
const char *what() const throw();