diff options
Diffstat (limited to 'cpp/test/Ice/exceptions/TestI.cpp')
-rw-r--r-- | cpp/test/Ice/exceptions/TestI.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/cpp/test/Ice/exceptions/TestI.cpp b/cpp/test/Ice/exceptions/TestI.cpp index e4430efb55a..59d0d192147 100644 --- a/cpp/test/Ice/exceptions/TestI.cpp +++ b/cpp/test/Ice/exceptions/TestI.cpp @@ -9,8 +9,20 @@ #include <Ice/Ice.h> #include <TestI.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() { @@ -166,3 +178,49 @@ ThrowerI::throwAfterException(const Ice::Current&) // throw A(); } + +void +ThrowerI::throwE(const Ice::Current&) +{ + throw E("E"); +} + +void +ThrowerI::throwF(const Ice::Current&) +{ + throw F("F"); +} + +void +ThrowerI::throwG(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"); + throw ex; + } +} + +void +ThrowerI::throwH(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"); + throw ex; + } +} |