diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2021-06-24 11:37:54 +0200 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2021-06-24 11:37:54 +0200 |
commit | 3cbad3a99b3645e99cedd39bd5129f7187e9d589 (patch) | |
tree | a8e07d47f17a0c0da05659f69a90ed06211a1fb8 /ACE/tests | |
parent | 89c2153b1ec4a1cf07a2a2c3b6c4f38b49fa2683 (diff) | |
download | ATCD-3cbad3a99b3645e99cedd39bd5129f7187e9d589.tar.gz |
Extend DLL test with throwing and catching exceptions through DLL boundaries
* ACE/tests/DLL_Test_Impl.cpp:
* ACE/tests/DLL_Test_Parent.cpp:
* ACE/tests/DLL_Test_Parent.h:
Diffstat (limited to 'ACE/tests')
-rw-r--r-- | ACE/tests/DLL_Test_Impl.cpp | 17 | ||||
-rw-r--r-- | ACE/tests/DLL_Test_Parent.cpp | 14 | ||||
-rw-r--r-- | ACE/tests/DLL_Test_Parent.h | 13 |
3 files changed, 43 insertions, 1 deletions
diff --git a/ACE/tests/DLL_Test_Impl.cpp b/ACE/tests/DLL_Test_Impl.cpp index 5b44f9d9261..73745824374 100644 --- a/ACE/tests/DLL_Test_Impl.cpp +++ b/ACE/tests/DLL_Test_Impl.cpp @@ -15,6 +15,7 @@ #include "ace/svc_export.h" #include "ace/OS_NS_string.h" #include <utility> +#include <memory> Hello_Impl::Hello_Impl () { @@ -116,13 +117,27 @@ Child::~Child () void Child::test () { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("child called\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("child test called\n"))); Data d; Data f(d); Data g; g = d; g = std::move(d); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testing exceptions\n"))); + + std::unique_ptr<Derived> excep (new Derived ()); + try + { + excep->_raise(); + } + catch (const Derived&) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("in catch derived\n"))); + } + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testing exceptions finished\n"))); } // -------------------------------------------------------- diff --git a/ACE/tests/DLL_Test_Parent.cpp b/ACE/tests/DLL_Test_Parent.cpp index 052fe612263..8fd63ec4ac6 100644 --- a/ACE/tests/DLL_Test_Parent.cpp +++ b/ACE/tests/DLL_Test_Parent.cpp @@ -15,3 +15,17 @@ Data::~Data () { } +Base::Base () +{ +} + +Derived::Derived () +{ +} + +void +Derived::_raise () const +{ + throw *this; +} + diff --git a/ACE/tests/DLL_Test_Parent.h b/ACE/tests/DLL_Test_Parent.h index 0d7ecc8e10b..2149ef0fbec 100644 --- a/ACE/tests/DLL_Test_Parent.h +++ b/ACE/tests/DLL_Test_Parent.h @@ -41,4 +41,17 @@ private: int8_t i {}; }; +class DLL_Test_Parent_Export Base +{ +public: + Base (); +}; + +class DLL_Test_Parent_Export Derived : public Base +{ +public: + Derived (); + void _raise () const; +}; + #endif /* ACE_TESTS_DLL_TEST_PARENT_H */ |