diff options
author | Jose <jose@zeroc.com> | 2011-12-07 01:29:37 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2011-12-07 01:29:37 +0100 |
commit | e621be781151af92e49d807a6fa5e964145ba0c6 (patch) | |
tree | 0c9698aa356c6ff4e81707e63cfd01e9a26e6116 /cpp/test/Ice/exceptions/TestAMDI.cpp | |
parent | Glacier2 C++ SessionHelper VC100 fix (diff) | |
download | ice-e621be781151af92e49d807a6fa5e964145ba0c6.tar.bz2 ice-e621be781151af92e49d807a6fa5e964145ba0c6.tar.xz ice-e621be781151af92e49d807a6fa5e964145ba0c6.zip |
ICE-4594 Patch for local exception and C++ ice_print
Diffstat (limited to 'cpp/test/Ice/exceptions/TestAMDI.cpp')
-rw-r--r-- | cpp/test/Ice/exceptions/TestAMDI.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/cpp/test/Ice/exceptions/TestAMDI.cpp b/cpp/test/Ice/exceptions/TestAMDI.cpp index 1d426eb3b6d..d439b5247d9 100644 --- a/cpp/test/Ice/exceptions/TestAMDI.cpp +++ b/cpp/test/Ice/exceptions/TestAMDI.cpp @@ -9,8 +9,20 @@ #include <Ice/Ice.h> #include <TestAMDI.h> +#include <TestCommon.h> using namespace Test; +using namespace std; + +bool +endsWith(const string& s, const string& findme) +{ + if(s.length() > findme.length()) + { + return 0 == s.compare(s.length() - findme.length(), findme.length(), findme); + } + return false; +} ThrowerI::ThrowerI() { @@ -198,3 +210,49 @@ ThrowerI::throwAfterException_async(const AMD_Thrower_throwAfterExceptionPtr& cb throw std::string(); } + +void +ThrowerI::throwE_async(const Test::AMD_Thrower_throwEPtr& cb, const Ice::Current&) +{ + cb->ice_exception(E("E")); +} + +void +ThrowerI::throwF_async(const Test::AMD_Thrower_throwFPtr& cb, const Ice::Current&) +{ + cb->ice_exception(F("F")); +} + +void +ThrowerI::throwG_async(const Test::AMD_Thrower_throwGPtr& cb, const Ice::Current&) +{ + try + { + throw G(__FILE__, __LINE__, "G"); + } + catch(const G& ex) + { + ostringstream os; + ex.ice_print(os); + test(endsWith(os.str(), "Test::G")); + test(ex.data == "G"); + cb->ice_exception(ex); + } +} + +void +ThrowerI::throwH_async(const Test::AMD_Thrower_throwHPtr& cb, const Ice::Current&) +{ + try + { + throw H(__FILE__, __LINE__, "H"); + } + catch(const H& ex) + { + ostringstream os; + ex.ice_print(os); + test(endsWith(os.str(), "Test::H data:'H'")); + test(ex.data == "H"); + cb->ice_exception(ex); + } +} |