7#include <gtest/gtest.h>
9#include <userver/utils/assert.hpp>
10#include <userver/utils/impl/disable_core_dumps.hpp>
12USERVER_NAMESPACE_BEGIN
16class DeathTestScope
final {
18 DeathTestScope() { utils::impl::dump_stacktrace_on_assert_failure =
false; }
19 ~DeathTestScope() { utils::impl::dump_stacktrace_on_assert_failure =
true; }
21 bool ShouldKeepIterating()
const noexcept {
return keep_iterating_; }
22 void StopIterating()
noexcept { keep_iterating_ =
false; }
25 utils::impl::DisableCoreDumps disable_core_dumps_;
26 bool keep_iterating_{
true};
39#define UEXPECT_DEATH(statement, message)
40 for (USERVER_NAMESPACE
::utest::impl::DeathTestScope
41 utest_impl_death_test_scope;
42 utest_impl_death_test_scope.ShouldKeepIterating();
43 utest_impl_death_test_scope.StopIterating())
44 EXPECT_DEATH
(statement, message)