From b1c2d4b61e95ae22bd918c44236f50002e3e48de Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 5 Apr 2016 22:11:47 +0200 Subject: Clarified object construction where 'enabled_shared_from_this' is used. Use it only where it is needed. --- tests/net/imap/IMAPCommandTest.cpp | 3 +-- tests/net/maildir/maildirStoreTest.cpp | 3 +-- tests/net/pop3/POP3StoreTest.cpp | 6 ++---- tests/net/pop3/POP3TestUtils.hpp | 2 +- tests/net/smtp/SMTPTransportTest.cpp | 18 ++++++------------ 5 files changed, 11 insertions(+), 21 deletions(-) (limited to 'tests') diff --git a/tests/net/imap/IMAPCommandTest.cpp b/tests/net/imap/IMAPCommandTest.cpp index 00054781..f274bb27 100644 --- a/tests/net/imap/IMAPCommandTest.cpp +++ b/tests/net/imap/IMAPCommandTest.cpp @@ -458,8 +458,7 @@ VMIME_TEST_SUITE_BEGIN(IMAPCommandTest) { vmime::shared_ptr cmd = IMAPCommand::createCommand("MY_COMMAND param1 param2"); - vmime::shared_ptr sess = - vmime::make_shared (); + vmime::shared_ptr sess = vmime::net::session::create(); vmime::shared_ptr auth = vmime::make_shared (); diff --git a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp index b456089a..11868c9d 100644 --- a/tests/net/maildir/maildirStoreTest.cpp +++ b/tests/net/maildir/maildirStoreTest.cpp @@ -473,8 +473,7 @@ private: vmime::shared_ptr createAndConnectStore() { - vmime::shared_ptr session = - vmime::make_shared (); + vmime::shared_ptr session = vmime::net::session::create(); vmime::shared_ptr store = session->getStore(getStoreURL()); diff --git a/tests/net/pop3/POP3StoreTest.cpp b/tests/net/pop3/POP3StoreTest.cpp index 5517f770..a6818d46 100644 --- a/tests/net/pop3/POP3StoreTest.cpp +++ b/tests/net/pop3/POP3StoreTest.cpp @@ -39,8 +39,7 @@ VMIME_TEST_SUITE_BEGIN(POP3StoreTest) void testCreateFromURL() { - vmime::shared_ptr sess - = vmime::make_shared (); + vmime::shared_ptr sess = vmime::net::session::create(); // POP3 vmime::utility::url url("pop3://pop3.vmime.org"); @@ -57,8 +56,7 @@ VMIME_TEST_SUITE_BEGIN(POP3StoreTest) void testConnectToInvalidServer() { - vmime::shared_ptr sess - = vmime::make_shared (); + vmime::shared_ptr sess = vmime::net::session::create(); vmime::utility::url url("pop3://invalid-pop3-server"); vmime::shared_ptr store = sess->getStore(url); diff --git a/tests/net/pop3/POP3TestUtils.hpp b/tests/net/pop3/POP3TestUtils.hpp index beb202b8..b0ec09b8 100644 --- a/tests/net/pop3/POP3TestUtils.hpp +++ b/tests/net/pop3/POP3TestUtils.hpp @@ -30,7 +30,7 @@ class POP3TestStore : public vmime::net::pop3::POP3Store public: POP3TestStore() - : POP3Store(vmime::make_shared (), + : POP3Store(vmime::net::session::create(), vmime::shared_ptr ()) { } diff --git a/tests/net/smtp/SMTPTransportTest.cpp b/tests/net/smtp/SMTPTransportTest.cpp index 5997588e..dd5546cc 100644 --- a/tests/net/smtp/SMTPTransportTest.cpp +++ b/tests/net/smtp/SMTPTransportTest.cpp @@ -44,8 +44,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest) void testConnectToInvalidServer() { - vmime::shared_ptr sess - = vmime::make_shared (); + vmime::shared_ptr sess = vmime::net::session::create(); vmime::utility::url url("smtp://invalid-smtp-server"); vmime::shared_ptr store = sess->getTransport(url); @@ -55,8 +54,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest) void testGreetingError() { - vmime::shared_ptr session = - vmime::make_shared (); + vmime::shared_ptr session = vmime::net::session::create(); vmime::shared_ptr tr = session->getTransport (vmime::utility::url("smtp://localhost")); @@ -70,8 +68,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest) void testMAILandRCPT() { - vmime::shared_ptr session = - vmime::make_shared (); + vmime::shared_ptr session = vmime::net::session::create(); vmime::shared_ptr tr = session->getTransport (vmime::utility::url("smtp://localhost")); @@ -96,8 +93,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest) void testChunking() { - vmime::shared_ptr session = - vmime::make_shared (); + vmime::shared_ptr session = vmime::net::session::create(); vmime::shared_ptr tr = session->getTransport (vmime::utility::url("smtp://localhost")); @@ -122,8 +118,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest) void testSize_Chunking() { - vmime::shared_ptr session = - vmime::make_shared (); + vmime::shared_ptr session = vmime::net::session::create(); vmime::shared_ptr tr = session->getTransport (vmime::utility::url("smtp://localhost")); @@ -149,8 +144,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest) void testSize_NoChunking() { - vmime::shared_ptr session = - vmime::make_shared (); + vmime::shared_ptr session = vmime::net::session::create(); vmime::shared_ptr tr = session->getTransport (vmime::utility::url("smtp://localhost")); -- cgit v1.2.3