diff options
Diffstat (limited to 'include/unotest/macros_test.hxx')
-rw-r--r-- | include/unotest/macros_test.hxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx index 2960dc0fbb23..6f55e34e7c87 100644 --- a/include/unotest/macros_test.hxx +++ b/include/unotest/macros_test.hxx @@ -13,6 +13,7 @@ #include <sal/config.h> #include <memory> +#include <functional> #include <config_gpgme.h> #include <rtl/ustring.hxx> #include <unotest/detail/unotestdllapi.hxx> @@ -38,6 +39,30 @@ namespace unotest { class OOO_DLLPUBLIC_UNOTEST MacrosTest { public: + class Resetter + { + private: + std::function<void ()> m_Func; + + public: + Resetter(std::function<void ()> const& rFunc) + : m_Func(rFunc) + { + } + ~Resetter() + { + try + { + m_Func(); + } + catch (...) // has to be reliable + { + fprintf(stderr, "resetter failed with exception\n"); + abort(); + } + } + }; + MacrosTest(); ~MacrosTest(); |