15#include <gtest/gtest.h>
17#include <userver/utest/death_tests.hpp>
18#include <userver/utest/impl/assert_macros.hpp>
19#include <userver/utils/invariant_error.hpp>
23#define IMPL_UTEST_ASSERT_THROW(statement, exception_type, message_substring,
25 if (const auto message_impl_utest =
26 USERVER_NAMESPACE
::utest::impl::AssertThrow(
27 [&] { statement; }, #statement,
28 &USERVER_NAMESPACE
::utest::impl::IsSubtype<exception_type>,
29 typeid(exception_type), message_substring);
30 !message_impl_utest.empty())
31 failure_macro(message_impl_utest.c_str())
34#define IMPL_UTEST_ASSERT_NO_THROW(statement, failure_macro)
35 if (const auto message_impl_utest =
36 USERVER_NAMESPACE
::utest::impl::AssertNoThrow([&] { statement; },
38 !message_impl_utest.empty())
39 failure_macro(message_impl_utest.c_str())
49#define UEXPECT_THROW_MSG(statement, exception_type, message_substring)
50 IMPL_UTEST_ASSERT_THROW
(statement, exception_type, message_substring,
51 GTEST_NONFATAL_FAILURE_
)
60#define UASSERT_THROW_MSG(statement, exception_type, message_substring)
61 IMPL_UTEST_ASSERT_THROW
(statement, exception_type, message_substring,
70#define UEXPECT_THROW(statement, exception_type)
71 IMPL_UTEST_ASSERT_THROW
(statement, exception_type, "",
72 GTEST_NONFATAL_FAILURE_
)
80#define UASSERT_THROW(statement, exception_type)
81 IMPL_UTEST_ASSERT_THROW
(statement, exception_type, "", GTEST_FATAL_FAILURE_
)
89#define UEXPECT_NO_THROW(statement)
90 IMPL_UTEST_ASSERT_NO_THROW
(statement, GTEST_NONFATAL_FAILURE_
)
98#define UASSERT_NO_THROW(statement)
99 IMPL_UTEST_ASSERT_NO_THROW
(statement, GTEST_FATAL_FAILURE_
)
104#define EXPECT_UINVARIANT_FAILURE_MSG(statement, message_substring)
105 UEXPECT_THROW_MSG(statement, USERVER_NAMESPACE::utils::InvariantError,
109#define EXPECT_UINVARIANT_FAILURE_MSG(statement, message_substring)
120#define EXPECT_UINVARIANT_FAILURE(statement)
121 EXPECT_UINVARIANT_FAILURE_MSG
(statement, "")