24#include <com/sun/star/uno/Any.hxx>
25#include <com/sun/star/uno/Exception.hpp>
27#include <cppunit/Message.h>
28#include <osl/thread.h>
29#include <rtl/string.hxx>
30#include <rtl/ustring.hxx>
33#include <cppunit/Protector.h>
38std::string
convert(std::u16string_view s16) {
40 static_assert(
sizeof (sal_Int32) <=
sizeof (std::string::size_type),
"got to be at least equal");
42 return std::string(s8);
45class Prot :
public CppUnit::Protector
50 Prot(
const Prot&) =
delete;
51 Prot& operator=(
const Prot&) =
delete;
54 CppUnit::Functor
const & functor,
55 CppUnit::ProtectorContext
const & context)
override;
59 CppUnit::Functor
const & functor, CppUnit::ProtectorContext
const & context)
63 }
catch (
const css::uno::Exception &e) {
68 "An uncaught exception of type " +
convert(
a.getValueTypeName()),
76extern "C" SAL_DLLPUBLIC_EXPORT CppUnit::Protector *
78 return std::getenv(
"CPPUNIT_PROPAGATE_EXCEPTIONS") ==
nullptr ?
new Prot :
nullptr;
Any SAL_CALL getCaughtException()
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
SAL_DLLPUBLIC_EXPORT CppUnit::Protector * unoexceptionprotector()