summaryrefslogtreecommitdiff
path: root/include/cppunit
diff options
context:
space:
mode:
authorTomas Chvatal <tchvatal@suse.cz>2012-08-06 16:17:16 +0200
committerTomas Chvatal <tchvatal@suse.cz>2012-08-06 16:17:16 +0200
commite349cf4c312afbeeb388327848a4f3c0378be534 (patch)
tree39056cebc2705d87970f52ed6f2efcc5a4bc1c0b /include/cppunit
parent5b48db1ee9fbaa6e7b48f31233d3e764093a53a3 (diff)
parent8e0179d81acba39ea868c275e5e57ab1bee42c5b (diff)
downloadcppunit-e349cf4c312afbeeb388327848a4f3c0378be534.tar.gz
Merge branch 'master' into feature/buildsystem_rewrite
Conflicts: .gitignore autogen.sh configure.in doc/Makefile.am examples/cppunittest/TestAssertTest.cpp
Diffstat (limited to 'include/cppunit')
-rw-r--r--include/cppunit/extensions/HelperMacros.h22
-rw-r--r--include/cppunit/extensions/TestCaseDecorator.h9
-rw-r--r--include/cppunit/extensions/TestDecorator.h2
3 files changed, 25 insertions, 8 deletions
diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h
index 12431e4..43fc08e 100644
--- a/include/cppunit/extensions/HelperMacros.h
+++ b/include/cppunit/extensions/HelperMacros.h
@@ -165,18 +165,28 @@
*/
#define CPPUNIT_TEST_SUITE_END() \
} \
+ \
+ struct CppUnitExDeleter { /* avoid deprecated auto_ptr warnings */ \
+ CPPUNIT_NS::TestSuite *suite; \
+ CppUnitExDeleter() : suite (0) {} \
+ ~CppUnitExDeleter() { delete suite; } \
+ CPPUNIT_NS::TestSuite *release() { \
+ CPPUNIT_NS::TestSuite *tmp = suite; suite = NULL; return tmp; \
+ } \
+ }; \
\
+public: \
static CPPUNIT_NS::TestSuite *suite() \
{ \
const CPPUNIT_NS::TestNamer &namer = getTestNamer__(); \
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( \
- new CPPUNIT_NS::TestSuite( namer.getFixtureName() )); \
+ CppUnitExDeleter guard; \
+ guard.suite = new CPPUNIT_NS::TestSuite( namer.getFixtureName() ); \
CPPUNIT_NS::ConcretTestFixtureFactory<TestFixtureType> factory; \
- CPPUNIT_NS::TestSuiteBuilderContextBase context( *suite.get(), \
+ CPPUNIT_NS::TestSuiteBuilderContextBase context( *guard.suite, \
namer, \
factory ); \
TestFixtureType::addTestsToSuite( context ); \
- return suite.release(); \
+ return guard.release(); \
} \
private: /* dummy typedef so that the macro can still end with ';'*/ \
typedef int CppUnitDummyTypedefForSemiColonEnding__
@@ -308,13 +318,13 @@
* #include <vector>
* class MyTest : public CppUnit::TestFixture {
* CPPUNIT_TEST_SUITE( MyTest );
- * CPPUNIT_TEST_EXCEPTION( testVectorAtThrow, std::invalid_argument );
+ * CPPUNIT_TEST_EXCEPTION( testVectorAtThrow, std::out_of_range );
* CPPUNIT_TEST_SUITE_END();
* public:
* void testVectorAtThrow()
* {
* std::vector<int> v;
- * v.at( 1 ); // must throw exception std::invalid_argument
+ * v.at( 1 ); // must throw exception std::out_of_range
* }
* };
* \endcode
diff --git a/include/cppunit/extensions/TestCaseDecorator.h b/include/cppunit/extensions/TestCaseDecorator.h
index 3a15ba9..effde25 100644
--- a/include/cppunit/extensions/TestCaseDecorator.h
+++ b/include/cppunit/extensions/TestCaseDecorator.h
@@ -13,7 +13,7 @@ CPPUNIT_NS_BEGIN
* of a test class without subclassing the test. Instead, one can
* subclass the decorater and use it to wrap the test class.
*
- * Does not assume ownership of the test it decorates
+ * Assumes ownership of the test it decorates
*/
class CPPUNIT_API TestCaseDecorator : public TestCase
{
@@ -31,6 +31,13 @@ public:
protected:
TestCase *m_test;
+
+private:
+
+ //prevent the creation of copy c'tor and operator=
+ TestCaseDecorator( const TestCaseDecorator& );
+ TestCaseDecorator& operator=( const TestCaseDecorator& );
+
};
diff --git a/include/cppunit/extensions/TestDecorator.h b/include/cppunit/extensions/TestDecorator.h
index 59d9a30..1c63b63 100644
--- a/include/cppunit/extensions/TestDecorator.h
+++ b/include/cppunit/extensions/TestDecorator.h
@@ -16,7 +16,7 @@ class TestResult;
* of a test class without subclassing the test. Instead, one can
* subclass the decorater and use it to wrap the test class.
*
- * Does not assume ownership of the test it decorates
+ * Assumes ownership of the test it decorates
*/
class CPPUNIT_API TestDecorator : public Test
{