X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.test.cc;h=58a2f2bf2fc2e5e1e9a7fd9a683111863fbde92a;hb=5746957b0da2bb228b9284e9493158c113b2bbe0;hp=9a29f71301cb8114b26e5b63bd55c81ed8d690fb;hpb=8ec0b7ed2df36144b52df5aa40497fc5409c31f7;p=senf.git diff --git a/Utils/Exception.test.cc b/Utils/Exception.test.cc index 9a29f71..58a2f2b 100644 --- a/Utils/Exception.test.cc +++ b/Utils/Exception.test.cc @@ -37,6 +37,40 @@ #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// +BOOST_AUTO_UNIT_TEST(wrapException) +{ + bool bad_cast (false); + + try { + try { + try { + try { + try { + throw std::bad_cast(); + } + SENF_WRAP_EXC(std::bad_cast) + } + SENF_WRAP_EXC(std::bad_cast) + } + catch (senf::ExceptionMixin & ex) { + ex << "\nspecial exception"; + throw; + } + } + catch (std::exception const & ex) { +#ifdef SENF_DEBUG + BOOST_CHECK( std::string(ex.what()).find("-- \n") != std::string::npos ); +#endif + BOOST_CHECK( std::string(ex.what()).find("special exception") != std::string::npos ); + throw; + } + } + catch (std::bad_cast &) { + bad_cast = true; + } + BOOST_CHECK( bad_cast ); +} + BOOST_AUTO_UNIT_TEST(errnoException) { try {