diff options
| author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-12-15 12:01:36 +0100 |
|---|---|---|
| committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-12-15 12:01:36 +0100 |
| commit | ff6ce1d7c00be2279f905b2f08cbbd67fa239ae7 (patch) | |
| tree | 65d64765acb2a6e18880ef2953a73a2c36e4086c | |
| parent | 9e22a4f7c7794ab1cbd808058c13356f38ed632a (diff) | |
| download | cppunit-ff6ce1d7c00be2279f905b2f08cbbd67fa239ae7.tar.gz | |
we no longer need a wrapper for the smart pointer case
| -rw-r--r-- | examples/cppunittest/ExceptionTest.cpp | 5 | ||||
| -rw-r--r-- | examples/cppunittest/HelperMacrosTest.cpp | 18 | ||||
| -rw-r--r-- | examples/msvc6/HostApp/ExampleTestCase.cpp | 6 | ||||
| -rw-r--r-- | examples/qt/ExampleTestCases.cpp | 6 | ||||
| -rw-r--r-- | include/cppunit/portability/Makefile.am | 1 | ||||
| -rw-r--r-- | include/cppunit/portability/SmartPtr.h | 6 | ||||
| -rw-r--r-- | src/cppunit/Protector.cpp | 5 |
7 files changed, 20 insertions, 27 deletions
diff --git a/examples/cppunittest/ExceptionTest.cpp b/examples/cppunittest/ExceptionTest.cpp index 856f561..c11a8de 100644 --- a/examples/cppunittest/ExceptionTest.cpp +++ b/examples/cppunittest/ExceptionTest.cpp @@ -1,8 +1,9 @@ #include "CoreSuite.h" #include "ExceptionTest.h" -#include <cppunit/portability/SmartPtr.h> #include <cppunit/Exception.h> +#include <memory> + CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ExceptionTest, coreSuiteName() ); @@ -79,7 +80,7 @@ ExceptionTest::testClone() { CPPUNIT_NS::SourceLine sourceLine( "fileName.cpp", 123 ); CPPUNIT_NS::Exception e( CPPUNIT_NS::Message("message"), sourceLine ); - CppUnitSmartPtr<CPPUNIT_NS::Exception> other( e.clone() ); + std::unique_ptr<CPPUNIT_NS::Exception> other( e.clone() ); checkIsSame( e, *other.get() ); } diff --git a/examples/cppunittest/HelperMacrosTest.cpp b/examples/cppunittest/HelperMacrosTest.cpp index 0e2a8b8..4e83b81 100644 --- a/examples/cppunittest/HelperMacrosTest.cpp +++ b/examples/cppunittest/HelperMacrosTest.cpp @@ -5,7 +5,7 @@ #include "MockTestCase.h" #include "SubclassedTestCase.h" #include <cppunit/TestResult.h> -#include <cppunit/portability/SmartPtr.h> +#include <memory> /* Note: - no unit test for CPPUNIT_TEST_SUITE_REGISTRATION... @@ -132,7 +132,7 @@ HelperMacrosTest::tearDown() void HelperMacrosTest::testNoSubclassing() { - CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( BaseTestCase::suite() ); + std::unique_ptr<CPPUNIT_NS::TestSuite> suite( BaseTestCase::suite() ); CPPUNIT_ASSERT_EQUAL( 1, suite->countTestCases() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectNoFailure(); @@ -145,7 +145,7 @@ HelperMacrosTest::testNoSubclassing() void HelperMacrosTest::testSubclassing() { - CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( SubclassedTestCase::suite() ); + std::unique_ptr<CPPUNIT_NS::TestSuite> suite( SubclassedTestCase::suite() ); CPPUNIT_ASSERT_EQUAL( 2, suite->countTestCases() ); m_testListener->setExpectedStartTestCall( 2 ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -158,7 +158,7 @@ HelperMacrosTest::testSubclassing() void HelperMacrosTest::testFail() { - CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( FailTestFixture::suite() ); + std::unique_ptr<CPPUNIT_NS::TestSuite> suite( FailTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectNoFailure(); @@ -170,7 +170,7 @@ HelperMacrosTest::testFail() void HelperMacrosTest::testFailToFail() { - CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( FailToFailTestFixture::suite() ); + std::unique_ptr<CPPUNIT_NS::TestSuite> suite( FailToFailTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -182,7 +182,7 @@ HelperMacrosTest::testFailToFail() void HelperMacrosTest::testException() { - CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( ExceptionTestFixture::suite() ); + std::unique_ptr<CPPUNIT_NS::TestSuite> suite( ExceptionTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectNoFailure(); @@ -194,7 +194,7 @@ HelperMacrosTest::testException() void HelperMacrosTest::testExceptionNotCaught() { - CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( ExceptionNotCaughtTestFixture::suite() ); + std::unique_ptr<CPPUNIT_NS::TestSuite> suite( ExceptionNotCaughtTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -206,7 +206,7 @@ HelperMacrosTest::testExceptionNotCaught() void HelperMacrosTest::testCustomTests() { - CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( CustomsTestTestFixture::suite() ); + std::unique_ptr<CPPUNIT_NS::TestSuite> suite( CustomsTestTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 2 ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -218,7 +218,7 @@ HelperMacrosTest::testCustomTests() void HelperMacrosTest::testAddTest() { - CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( AddTestTestFixture::suite() ); + std::unique_ptr<CPPUNIT_NS::TestSuite> suite( AddTestTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 7 ); m_testListener->setExpectedAddFailureCall( 0 ); diff --git a/examples/msvc6/HostApp/ExampleTestCase.cpp b/examples/msvc6/HostApp/ExampleTestCase.cpp index 727fd30..85aa468 100644 --- a/examples/msvc6/HostApp/ExampleTestCase.cpp +++ b/examples/msvc6/HostApp/ExampleTestCase.cpp @@ -1,5 +1,5 @@ #include "ExampleTestCase.h" -#include <cppunit/portability/SmartPtr.h> +#include <memory> CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCase ); @@ -32,8 +32,8 @@ void ExampleTestCase::testAdd () void ExampleTestCase::testEquals () { - CppUnitSmartPtr<long> l1 (new long (12)); - CppUnitSmartPtr<long> l2 (new long (12)); + std::unique_ptr<long> l1 (new long (12)); + std::unique_ptr<long> l2 (new long (12)); CPPUNIT_ASSERT_EQUAL (12, 12); CPPUNIT_ASSERT_EQUAL (12L, 12L); diff --git a/examples/qt/ExampleTestCases.cpp b/examples/qt/ExampleTestCases.cpp index 03f1593..457e4d4 100644 --- a/examples/qt/ExampleTestCases.cpp +++ b/examples/qt/ExampleTestCases.cpp @@ -1,5 +1,5 @@ #include "ExampleTestCases.h" -#include <cppunit/portability/SmartPtr.h> +#include <memory> CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCases ); @@ -29,8 +29,8 @@ void ExampleTestCases::testAdd () void ExampleTestCases::testEquals () { - CppUnitSmartPtr<long> l1 (new long (12)); - CppUnitSmartPtr<long> l2 (new long (12)); + std::unique_ptr<long> l1 (new long (12)); + std::unique_ptr<long> l2 (new long (12)); CPPUNIT_ASSERT_EQUAL (12, 12); CPPUNIT_ASSERT_EQUAL (12L, 12L); diff --git a/include/cppunit/portability/Makefile.am b/include/cppunit/portability/Makefile.am index ce85cd6..1a678ca 100644 --- a/include/cppunit/portability/Makefile.am +++ b/include/cppunit/portability/Makefile.am @@ -3,4 +3,3 @@ libcppunitincludedir = $(includedir)/cppunit/portability libcppunitinclude_HEADERS = \ FloatingPoint.h \ Stream.h \ - SmartPtr.h diff --git a/include/cppunit/portability/SmartPtr.h b/include/cppunit/portability/SmartPtr.h deleted file mode 100644 index 76e2183..0000000 --- a/include/cppunit/portability/SmartPtr.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef CPPUNIT_PORTABILITY_CPPUNITSMARTPTR_H -#define CPPUNIT_PORTABILITY_CPPUNITSMARTPTR_H - -#define CppUnitSmartPtr std::unique_ptr - -#endif // CPPUNIT_PORTABILITY_CPPUNITDEQUE_H diff --git a/src/cppunit/Protector.cpp b/src/cppunit/Protector.cpp index 492bec1..99188bb 100644 --- a/src/cppunit/Protector.cpp +++ b/src/cppunit/Protector.cpp @@ -2,7 +2,6 @@ #include <cppunit/Message.h> #include <cppunit/Protector.h> #include <cppunit/TestResult.h> -#include <cppunit/portability/SmartPtr.h> #include "ProtectorContext.h" #include <memory> @@ -22,7 +21,7 @@ void Protector::reportError( const ProtectorContext &context, const Exception &error ) const { - CppUnitSmartPtr<Exception> actualError( error.clone() ); + std::unique_ptr<Exception> actualError( error.clone() ); actualError->setMessage( actualMessage( actualError->message(), context ) ); context.m_result->addError( context.m_test, actualError.release() ); @@ -43,7 +42,7 @@ void Protector::reportFailure( const ProtectorContext &context, const Exception &failure ) const { - CppUnitSmartPtr<Exception> actualFailure( failure.clone() ); + std::unique_ptr<Exception> actualFailure( failure.clone() ); actualFailure->setMessage( actualMessage( actualFailure->message(), context ) ); context.m_result->addFailure( context.m_test, actualFailure.release() ); |
