From 82e1a690d97cd9d9f392beccbb6b1d35f3573f08 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 1 Dec 2009 14:24:55 +0000 Subject: Fixed directory renaming. --- tests/net/maildir/maildirStoreTest.cpp | 20 ++++++++++-- tests/testUtils.cpp | 58 ++++++++++++++++++++++++++++++++++ tests/testUtils.hpp | 4 +++ 3 files changed, 80 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp index 5aad90b1..5f8c7033 100644 --- a/tests/net/maildir/maildirStoreTest.cpp +++ b/tests/net/maildir/maildirStoreTest.cpp @@ -322,12 +322,28 @@ public: void testRenameFolder_KMail() { - testRenameFolderImpl(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL); + try + { + testRenameFolderImpl(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL); + } + catch (vmime::exception& e) + { + std::cerr << e; + throw e; + } } void testRenameFolder_Courier() { - testRenameFolderImpl(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER); + try + { + testRenameFolderImpl(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER); + } + catch (vmime::exception& e) + { + std::cerr << e; + throw e; + } } void testRenameFolderImpl(const vmime::string* const dirs, const vmime::string* const files) diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp index ee17c923..36455cff 100644 --- a/tests/testUtils.cpp +++ b/tests/testUtils.cpp @@ -187,3 +187,61 @@ vmime::ref testTimeoutHandlerFactory::create() return vmime::create (); } + + +// Exception helper +std::ostream& operator<<(std::ostream& os, const vmime::exception& e) +{ + os << "* vmime::exceptions::" << e.name() << std::endl; + os << " what = " << e.what() << std::endl; + + // More information for special exceptions + if (dynamic_cast (&e)) + { + const vmime::exceptions::command_error& cee = + dynamic_cast (e); + + os << " command = " << cee.command() << std::endl; + os << " response = " << cee.response() << std::endl; + } + + if (dynamic_cast (&e)) + { + const vmime::exceptions::invalid_response& ir = + dynamic_cast (e); + + os << " response = " << ir.response() << std::endl; + } + + if (dynamic_cast (&e)) + { + const vmime::exceptions::connection_greeting_error& cgee = + dynamic_cast (e); + + os << " response = " << cgee.response() << std::endl; + } + + if (dynamic_cast (&e)) + { + const vmime::exceptions::authentication_error& aee = + dynamic_cast (e); + + os << " response = " << aee.response() << std::endl; + } + + if (dynamic_cast (&e)) + { + const vmime::exceptions::filesystem_exception& fse = + dynamic_cast (e); + + os << " path = " << vmime::platform::getHandler()-> + getFileSystemFactory()->pathToString(fse.path()) << std::endl; + } + + if (e.other() != NULL) + os << *e.other(); + + return os; +} + + diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp index 227d1b36..9aee153c 100644 --- a/tests/testUtils.hpp +++ b/tests/testUtils.hpp @@ -305,3 +305,7 @@ public: vmime::ref create(); }; + +// Exception helper +std::ostream& operator<<(std::ostream& os, const vmime::exception& e); + -- cgit