7#include <gtest/gtest.h>
9#include <userver/utils/assert.hpp>
10#include <userver/utils/impl/disable_core_dumps.hpp>
12USERVER_NAMESPACE_BEGIN
14namespace utest::impl {
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 utest_impl_death_test_scope;
41 utest_impl_death_test_scope.ShouldKeepIterating();
42 utest_impl_death_test_scope.StopIterating())
43 EXPECT_DEATH
(statement, message)